version 1.40.130 release
[feisty_meow.git] / scripts / core / prep_feisty_host.sh
1 #!/bin/bash
2
3 # this is the feisty meow host preparation script.  it installs all the packages required to run and build feisty meow scripts and applications.
4 # this script may still be a bit incomplete; we definitely use a lot of unix and linux tools in different scripts.
5
6 # preconditions and dependencies--this script itself depends on:
7 #   feisty meow
8 #   bash
9 #   anything else?
10
11 ####
12
13 # something borrowed...
14 function exit_on_error() {
15   if [ $? -ne 0 ]; then
16     echo -e "\n\nan important action failed and this script will stop:\n\n$*\n\n*** Exiting script..."
17     error_sound
18     exit 1
19   fi
20 }
21
22 ####
23
24 # load feisty meow environment here, but first test that we *can* load it.
25
26 #hmmm: currently, this script needs the system to have already been configured?
27 #  that's the implication of calling launch_feisty...
28 #  can we find that same bootstrapping code that will reconfigure first?
29 #more about this...
30 #    hmmm: we need clean starty type approach!  must not expect feisty to already be configured for use!
31 #    e.g.?? $ bash /opt/feistymeow.org/feisty_meow/scripts/core/reconfigure_feisty_meow.sh
32 #    hmmm: above ALSO ESSENTIAL TO GET RIGHT!
33
34 PHASE_MESSAGE="Checking integrity of Feisty Meow subsystem"
35 if [ -z $FEISTY_MEOW_APEX ]; then
36   false; exit_on_error $PHASE_MESSAGE
37 fi
38
39 # simple brute force check.  can we go there?
40 pushd $FEISTY_MEOW_APEX &> /dev/null
41 exit_on_error locating feisty meow top-level folder
42 popd &> /dev/null
43
44 # now ask feisty if it's there; should work as long as our scripts are in place.
45 bash $FEISTY_MEOW_APEX/scripts/core/is_feisty_up.sh
46 exit_on_error $PHASE_MESSAGE
47
48 # standard load-up.
49 #hmmm: this will currently fail if reconfigure has never been called.
50 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
51
52 ####
53
54 # first the crucial bits for scripts to work...
55
56 PHASE_MESSAGE="installing perl file and diff modules"
57
58 # ubuntu or debian or other apt-based OSes...
59 if whichable apt; then
60   sudo apt install libfile-which-perl libtext-diff-perl
61   exit_on_error $PHASE_MESSAGE
62 # rpm based with yum available...
63 elif whichable yum; then  
64   sudo yum install perl-File-Which perl-Text-Diff
65   exit_on_error $PHASE_MESSAGE
66 # macos based...
67 elif [ ! -z "$IS_DARWIN" ]; then
68
69 #hmmm: not quite right yet...
70   brew install blah blah? lots?
71   exit_on_error $PHASE_MESSAGE
72
73 # windows-based with cygwin (or we'll fail out).
74 elif [ "$OS" == "Windows_NT" ]; then
75  
76 #hmmm: install apt-cyg!
77 # we need this to do the following step, so why not automate that?
78 # can we at least check for the packages we absolutely need?
79
80 #hmmm: can we bootstrap and still survive on the basic cygwin modules if already installed?
81 #  then we could use our huge list to get the rest!
82
83 #hmmm: is there any other way to get the missing ones, that we need for apt-cyg?
84
85   apt-cyg install perl-File-Which perl-Text-Diff
86   exit_on_error $PHASE_MESSAGE
87 fi
88
89 ####
90
91 # then the builder packages...
92
93 PHASE_MESSAGE="installing code builder packages"
94
95 # ubuntu or debian or other apt-based OSes...
96 if whichable apt; then
97   sudo apt install build-essential librtmp-dev libcurl4-gnutls-dev libssl-dev
98   exit_on_error $PHASE_MESSAGE
99 # rpm based with yum available...
100 elif whichable yum; then  
101   sudo yum install gcc gcc-c++ openssl-devel.x86_64 curl-devel
102   exit_on_error $PHASE_MESSAGE
103 # macos based...
104 elif [ ! -z "$IS_DARWIN" ]; then
105
106 #hmmm: not quite right yet...
107   brew install blork blork? lots?
108   exit_on_error $PHASE_MESSAGE
109
110 # windows-based with cygwin (or we'll fail out).
111 elif [ "$OS" == "Windows_NT" ]; then
112  
113 #hmmm: unknown list needed still...
114   apt-cyg install fugazi combustinatorinibasil scampnific
115   exit_on_error $PHASE_MESSAGE
116 fi
117
118 ####
119
120 # install other external packages and whatnot.
121
122 #hmmm: anything else to get installed?
123   #hmmm: java?
124   #hmmm: python?
125   #hmmm: perl itself!?
126
127
128 ####
129
130 # get ready to finish up.
131
132 #...finishing steps...  if any.
133
134 # all done now.
135 exit 0
136
137 ####
138
139
140 #############################
141 #scav line
142 #############################
143
144 The "kona" collection depends on Java version 8 or better.
145 | Ubuntu:
146 | Set up the java PPA archive as described here:
147 | https://launchpad.net/~webupd8team/+archive/ubuntu/java
148
149 #not needed at the moment.
150 #echo "bailing because script is immature.  farts!"
151 #exit 1
152