3 # this is the feisty meow host preparation script. it installs all the packages required to run and build feisty meow scripts and applications.
5 # preconditions and dependencies--this script itself depends on:
10 # note that this list of items is never totally complete, since feisty meow keeps expanding and mutating. for example, we now have a few
11 # python scripts starting to sneak in. there are assuredly lots of python packages we should be installing in here now, but we aren't yet.
12 # this is a best effort script, to at least get feisty meow able to run its core scripts and to build. although it's always appreciated
13 # when things we rely on get installed too...
17 ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )"
18 CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )"
19 THIS_TOOL_NAME="$(basename "$0")"
21 # set up the feisty_meow dir.
22 pushd "$CORE_SCRIPTS_DIR/../.." &>/dev/null
23 #source "$CORE_SCRIPTS_DIR/functions.sh"
24 echo originating folder is $ORIGINATING_FOLDER
25 export FEISTY_MEOW_APEX="$(/bin/pwd)"
26 echo feisty now apex is FEISTY_MEOW_APEX=$FEISTY_MEOW_APEX
28 # establish whether this is darwin (MacOS) or not.
29 export IS_DARWIN="$(echo $OSTYPE | grep -i darwin)"
35 # these come from other places in the feisty meow ecosystem, but they are here
36 # because this script is kind of a bootstrapping process for our scripts and code.
37 # we don't want to assume anything about the presence of the rest of feisty meow
38 # at this point in the process.
40 function exit_on_error() {
42 echo -e "\n\nan important action failed and this script will stop:\n\n$*\n\n*** Exiting script..."
54 local WHICHER="$(/usr/bin/which which 2>/dev/null)";
60 sporkenz=$($WHICHER "$to_find" 2>/dev/null);
68 #hmmm: copy to mainline scripts.
69 function apt_cyg_finder()
71 if whichable apt-cyg; then
73 #hmmm: is that the right syntax for bash?
76 The apt-cyg tool does not seem to be available for cygwin.
77 Please follow the install instructions at:
78 https://github.com/transcode-open/apt-cyg
80 return 13 # not found.
86 #hmmm: copy to mainline scripts also.
87 # figures out what kind of installation packager application is
88 # used on this machine and invokes it to install the list of
89 # packages provided as parameters.
90 function install_system_package()
92 local packages=("${@}")
93 # pull out the array of packages from the command line.
94 if whichable apt; then
95 # ubuntu or debian or other apt-based OSes...
96 sudo apt install "${packages[@]}"
98 elif whichable yum; then
99 # rpm based with yum available...
100 sudo yum install "${packages[@]}"
102 elif [ ! -z "$IS_DARWIN" ]; then
104 brew install "${packages[@]}"
106 elif [ "$OS" == "Windows_NT" ]; then
107 # windows-based with cygwin (or we'll fail out currently).
108 if apt_cyg_finder; then
109 apt-cyg install perl-File-Which perl-Text-Diff
112 echo "apt-cyg is not currently available on this system. please install cygwin and apt-cyg."
116 echo "Unknown installer application for this platform."
123 # load feisty meow environment here, but first test that we *can* load it.
125 #hmmm: currently, this script needs the system to have already been configured?
126 # that's the implication of calling launch_feisty...
127 # can we find that same bootstrapping code that will reconfigure first?
129 # hmmm: we need clean starty type approach! must not expect feisty to already be configured for use!
130 # e.g.?? $ bash /opt/feistymeow.org/feisty_meow/scripts/core/reconfigure_feisty_meow.sh
131 # hmmm: above ALSO ESSENTIAL TO GET RIGHT!
133 BASE_PHASE_MESSAGE="Feisty Meow subsystems integrity check: "
135 # is our main variable set?
136 PHASE_MESSAGE="$BASE_PHASE_MESSAGE presence of FEISTY_MEOW_APEX variable"
137 if [ -z "$FEISTY_MEOW_APEX" ]; then
138 false; exit_on_error $PHASE_MESSAGE
141 # simple brute force check. can we go there?
142 PHASE_MESSAGE="$BASE_PHASE_MESSAGE check on directory $FEISTY_MEOW_APEX"
143 pushd $FEISTY_MEOW_APEX &> /dev/null
144 exit_on_error $PHASE_MESSAGE
147 # now ask feisty if it's there; should work as long as our scripts are in place.
148 #PHASE_MESSAGE="$BASE_PHASE_MESSAGE inquiry is_feisty_up"
149 #bash $FEISTY_MEOW_APEX/scripts/core/is_feisty_up.sh
150 #exit_on_error $PHASE_MESSAGE
153 #hmmm: this will currently fail if reconfigure has never been called.
154 #NO NO NO. source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
155 # we are preparing to get feisty running; how can we use feisty during
156 # that process? so bad.
160 # figure out which kind of OS we're on first, from ground up by seeing
161 # how this system can install things.
163 opsystem_here=unknown
165 if whichable apt; then
166 # ubuntu or debian or other apt-based OSes...
167 opsystem_here=debianesque
168 elif whichable yum; then
169 # rpm based with yum available...
170 opsystem_here=redhatty
171 elif [ ! -z "$IS_DARWIN" ]; then
174 elif [ "$OS" == "Windows_NT" ]; then
175 # windows-based with cygwin (or we'll fail out currently).
176 opsystem_here=windoze
181 # default value of our package list is to fail out, since we
182 # may not be able to determine what OS this is running on.
187 # first we install the low-level crucial bits for scripts to work...
189 PHASE_MESSAGE="installing script modules"
191 if [ "$opsystem_here" == "debianesque" ]; then
192 PAX=(libfile-which-perl libtext-diff-perl)
193 elif [ "$opsystem_here" == "redhatty" ]; then
194 PAX=(perl-Env perl-File-Which perl-Text-Diff)
195 elif [ "$opsystem_here" == "macos" ]; then
196 PAX=(dos2unix openssl)
197 elif [ "$opsystem_here" == "windoze" ]; then
198 PAX=(perl-File-Which perl-Text-Diff)
201 install_system_package "${PAX[@]}"
202 exit_on_error $PHASE_MESSAGE
206 # then the builder packages...
208 PHASE_MESSAGE="installing code builder packages"
210 if [ "$opsystem_here" == "debianesque" ]; then
211 PAX=(mawk build-essential librtmp-dev libcurl4-gnutls-dev libssl-dev)
212 elif [ "$opsystem_here" == "redhatty" ]; then
213 PAX=(curl-devel gcc gcc-c++ make gawk openssl-devel.x86_64 zlib-devel)
214 elif [ "$opsystem_here" == "macos" ]; then
215 PAX=(mawk gpg meld openjdk)
216 elif [ "$opsystem_here" == "windoze" ]; then
217 PAX=(gawk libcurl-devel meld mingw64-i686-openssl openssl openssl-devel libssl-devel zlib-devel)
220 install_system_package "${PAX[@]}"
221 exit_on_error $PHASE_MESSAGE
225 # install other external packages and whatnot.
227 PHASE_MESSAGE="installing additional helper packages"
229 if [ "$opsystem_here" == "debianesque" ]; then
230 PAX=(screen python3 python3-pip xserver-xorg xorg-docs)
231 elif [ "$opsystem_here" == "redhatty" ]; then
232 PAX=(screen python3 python3-pip xserver-xorg xorg-docs)
233 elif [ "$opsystem_here" == "macos" ]; then
234 PAX=(screen python3 pip xserver-xorg xorg-docs)
235 elif [ "$opsystem_here" == "windoze" ]; then
236 PAX=(screen python3 pip3 xserver-xorg xorg-docs)
239 install_system_package "${PAX[@]}"
240 exit_on_error $PHASE_MESSAGE
244 # get ready to finish up.
246 #...finishing steps... if any.
254 #############################
256 #############################
258 #The "kona" collection depends on Java version 8 or better.
260 #| Set up the java PPA archive as described here:
261 #| https://launchpad.net/~webupd8team/+archive/ubuntu/java
263 #not needed at the moment.
264 #echo "bailing because script is immature. farts!"