Bob Mottram 11 lat temu
rodzic
commit
8198d40bd8
1 zmienionych plików z 42 dodań i 22 usunięć
  1. 42
    22
      install-freedombone.sh

+ 42
- 22
install-freedombone.sh Wyświetl plik

116
     touch $COMPLETION_FILE
116
     touch $COMPLETION_FILE
117
 fi
117
 fi
118
 
118
 
119
+function show_help {
120
+  echo ''
121
+  echo './install-freedombone.sh [domain] [username] [subdomain code] [system type]'
122
+  echo ''
123
+  echo 'domain'
124
+  echo '------'
125
+  echo 'This is your domain name or freedns subdomain.'
126
+  echo ''
127
+  echo 'username'
128
+  echo '--------'
129
+  echo ''
130
+  echo 'This will be your username on the system. It should be all'
131
+  echo 'lower case and contain no spaces'
132
+  echo ''
133
+  echo 'subdomain code'
134
+  echo '--------------'
135
+  echo 'This is the freedns dynamic DNS code for your subdomain.'
136
+  echo "To find it from https://freedns.afraid.org select 'Dynamic DNS',"
137
+  echo "then 'quick cron example' and copy the code located between "
138
+  echo "'?' and '=='."
139
+  echo ''
140
+  echo 'system type'
141
+  echo '-----------'
142
+  echo 'This can either be blank if you wish to install the full system,'
143
+  echo 'or for more specialised variants you can specify "mailbox", "cloud",'
144
+  echo '"chat", "social" or "writer"'
145
+  echo ''
146
+}
147
+
119
 function argument_checks {
148
 function argument_checks {
120
-  SYNTAX='./install-freedombone.sh [domain] [username] [subdomain code] [system ty[e]'
121
   if [ ! -d /home/$MY_USERNAME ]; then
149
   if [ ! -d /home/$MY_USERNAME ]; then
122
       echo "There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
150
       echo "There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
123
       exit 1
151
       exit 1
124
   fi
152
   fi
125
   if [ ! $DOMAIN_NAME ]; then
153
   if [ ! $DOMAIN_NAME ]; then
126
-      echo ''
127
-      echo $SYNTAX
128
-      echo 'Please specify your domain name'
154
+	  show_help
129
       exit 2
155
       exit 2
130
   fi
156
   fi
131
   if [ ! $MY_USERNAME ]; then
157
   if [ ! $MY_USERNAME ]; then
132
-      echo ''
133
-      echo $SYNTAX
134
-      echo 'Please specify your username'
158
+	  show_help
135
       exit 3
159
       exit 3
136
   fi
160
   fi
137
   if [ ! $FREEDNS_SUBDOMAIN_CODE ]; then
161
   if [ ! $FREEDNS_SUBDOMAIN_CODE ]; then
138
-      echo ''
139
-      echo $SYNTAX
140
-      echo 'Please specify the freedns subdomain code.  To find it from '
141
-      echo "https://freedns.afraid.org select 'Dynamic DNS', then 'quick "
142
-      echo "cron example' and copy the code located between '?' and '=='."
162
+	  show_help
143
       exit 4
163
       exit 4
144
   fi
164
   fi
145
 }
165
 }
814
 }
834
 }
815
 
835
 
816
 function configure_email {
836
 function configure_email {
817
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
837
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
818
       return
838
       return
819
   fi
839
   fi
820
   if grep -Fxq "configure_email" $COMPLETION_FILE; then
840
   if grep -Fxq "configure_email" $COMPLETION_FILE; then
901
 
921
 
902
 function spam_filtering {
922
 function spam_filtering {
903
   # NOTE: spamassassin installation currently doesn't work, sa-compile fails with a make error 23/09/2014
923
   # NOTE: spamassassin installation currently doesn't work, sa-compile fails with a make error 23/09/2014
904
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
924
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
905
       return
925
       return
906
   fi
926
   fi
907
   if grep -Fxq "spam_filtering" $COMPLETION_FILE; then
927
   if grep -Fxq "spam_filtering" $COMPLETION_FILE; then
1000
 }
1020
 }
1001
 
1021
 
1002
 function configure_imap {
1022
 function configure_imap {
1003
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1023
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1004
       return
1024
       return
1005
   fi
1025
   fi
1006
   if grep -Fxq "configure_imap" $COMPLETION_FILE; then
1026
   if grep -Fxq "configure_imap" $COMPLETION_FILE; then
1028
 }
1048
 }
1029
 
1049
 
1030
 function configure_gpg {
1050
 function configure_gpg {
1031
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1051
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1032
       return
1052
       return
1033
   fi
1053
   fi
1034
   if grep -Fxq "configure_gpg" $COMPLETION_FILE; then
1054
   if grep -Fxq "configure_gpg" $COMPLETION_FILE; then
1089
 }
1109
 }
1090
 
1110
 
1091
 function email_client {
1111
 function email_client {
1092
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1112
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1093
       return
1113
       return
1094
   fi
1114
   fi
1095
   if grep -Fxq "email_client" $COMPLETION_FILE; then
1115
   if grep -Fxq "email_client" $COMPLETION_FILE; then
1195
 }
1215
 }
1196
 
1216
 
1197
 function folders_for_mailing_lists {
1217
 function folders_for_mailing_lists {
1198
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1218
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1199
       return
1219
       return
1200
   fi
1220
   fi
1201
   if grep -Fxq "folders_for_mailing_lists" $COMPLETION_FILE; then
1221
   if grep -Fxq "folders_for_mailing_lists" $COMPLETION_FILE; then
1244
 }
1264
 }
1245
 
1265
 
1246
 function folders_for_email_addresses {
1266
 function folders_for_email_addresses {
1247
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1267
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1248
       return
1268
       return
1249
   fi
1269
   fi
1250
   if grep -Fxq "folders_for_email_addresses" $COMPLETION_FILE; then
1270
   if grep -Fxq "folders_for_email_addresses" $COMPLETION_FILE; then
1311
 }
1331
 }
1312
 
1332
 
1313
 function create_private_mailing_list {
1333
 function create_private_mailing_list {
1314
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1334
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1315
       return
1335
       return
1316
   fi
1336
   fi
1317
   # This installation doesn't work, results in ruby errors
1337
   # This installation doesn't work, results in ruby errors
1372
 }
1392
 }
1373
 
1393
 
1374
 function import_email {
1394
 function import_email {
1375
-  if [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1395
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1376
       return
1396
       return
1377
   fi
1397
   fi
1378
   EMAIL_COMPLETE_MSG='  *** Freedombone mailbox installation is complete ***'
1398
   EMAIL_COMPLETE_MSG='  *** Freedombone mailbox installation is complete ***'
1438
 }
1458
 }
1439
 
1459
 
1440
 function install_owncloud {
1460
 function install_owncloud {
1441
-  if [[ $SYSTEM_TYPE == "email" || $SYSTEM_TYPE == "mailbox" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1461
+  if [[ $SYSTEM_TYPE == "writer" || $SYSTEM_TYPE == "email" || $SYSTEM_TYPE == "mailbox" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
1442
       return
1462
       return
1443
   fi
1463
   fi
1444
   OWNCLOUD_COMPLETION_MSG1=" *** Freedombone $SYSTEM_TYPE is now installed ***"
1464
   OWNCLOUD_COMPLETION_MSG1=" *** Freedombone $SYSTEM_TYPE is now installed ***"