added mawk to prep_feisty_host
[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 if whichable apt; then
59   # ubuntu or debian or other apt-based OSes...
60   sudo apt install libfile-which-perl libtext-diff-perl
61   exit_on_error $PHASE_MESSAGE
62 elif whichable yum; then  
63   # rpm based with yum available...
64   sudo yum install perl-File-Which perl-Text-Diff
65   exit_on_error $PHASE_MESSAGE
66 elif [ ! -z "$IS_DARWIN" ]; then
67   # macos based...
68   brew install dos2unix openssl
69   exit_on_error $PHASE_MESSAGE
70 elif [ "$OS" == "Windows_NT" ]; then
71   # windows-based with cygwin (or we'll fail out).
72  
73 #hmmm: install apt-cyg!
74 # we need this to do the following step, so why not automate that?
75 # can we at least check for the packages we absolutely need?
76
77 #hmmm: can we bootstrap and still survive on the basic cygwin modules if already installed?
78 #  then we could use our huge list to get the rest!
79
80 #hmmm: is there any other way to get the missing ones, that we need for apt-cyg?
81
82   apt-cyg install perl-File-Which perl-Text-Diff
83   exit_on_error $PHASE_MESSAGE
84 fi
85
86 ####
87
88 # then the builder packages...
89
90 PHASE_MESSAGE="installing code builder packages"
91
92 if whichable apt; then
93   # ubuntu or debian or other apt-based OSes...
94   sudo apt install mawk build-essential librtmp-dev libcurl4-gnutls-dev libssl-dev
95   exit_on_error $PHASE_MESSAGE
96 elif whichable yum; then  
97   # rpm based with yum available...
98   sudo yum install mawk gcc gcc-c++ openssl-devel.x86_64 curl-devel
99   exit_on_error $PHASE_MESSAGE
100 elif [ ! -z "$IS_DARWIN" ]; then
101   # macos based...
102 #hmmm: still working on these...
103   brew install mawk gpg meld openjdk 
104   exit_on_error $PHASE_MESSAGE
105 elif [ "$OS" == "Windows_NT" ]; then
106   # windows-based with cygwin (or we'll fail out).
107  
108 echo need to fix apt cyg install list.
109 #hmmm: unknown list needed still...
110 #      actually it's not unknown; it's in our docs as a separate file for cygwin.
111 #      plug those packages into here please.
112   apt-cyg install mawk 
113   exit_on_error $PHASE_MESSAGE
114 fi
115
116 ####
117
118 # install other external packages and whatnot.
119
120 #hmmm: anything else to get installed?
121   #hmmm: java?
122   #hmmm: python?
123   #hmmm: perl itself!?
124
125
126 ####
127
128 # get ready to finish up.
129
130 #...finishing steps...  if any.
131
132 # all done now.
133 exit 0
134
135 ####
136
137
138 #############################
139 #scav line
140 #############################
141
142 The "kona" collection depends on Java version 8 or better.
143 | Ubuntu:
144 | Set up the java PPA archive as described here:
145 | https://launchpad.net/~webupd8team/+archive/ubuntu/java
146
147 #not needed at the moment.
148 #echo "bailing because script is immature.  farts!"
149 #exit 1
150