Ver código fonte

Make the main project repo customisable

So that we're not dependent on github
Bob Mottram 9 anos atrás
pai
commit
73f46bdc99

+ 8
- 1
src/freedombone-image Ver arquivo

33
 export TEXTDOMAIN=${PROJECT_NAME}-image
33
 export TEXTDOMAIN=${PROJECT_NAME}-image
34
 export TEXTDOMAINDIR="/usr/share/locale"
34
 export TEXTDOMAINDIR="/usr/share/locale"
35
 
35
 
36
+PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
37
+
36
 # recommended RAM for virtual machines
38
 # recommended RAM for virtual machines
37
 VM_MEMORY='1G'
39
 VM_MEMORY='1G'
38
 
40
 
199
     shift
201
     shift
200
     ONION_ONLY="$1"
202
     ONION_ONLY="$1"
201
     ;;
203
     ;;
204
+    -r|--repo|--repository)
205
+    shift
206
+    PROJECT_REPO="$1"
207
+    ;;
202
     *)
208
     *)
203
     # unknown option
209
     # unknown option
204
     ;;
210
     ;;
283
     MINIMAL_INSTALL="$MINIMAL_INSTALL" \
289
     MINIMAL_INSTALL="$MINIMAL_INSTALL" \
284
     SSH_PORT="$SSH_PORT" \
290
     SSH_PORT="$SSH_PORT" \
285
     ONION_ONLY="$ONION_ONLY" \
291
     ONION_ONLY="$ONION_ONLY" \
286
-    IMAGE_NAME="$IMAGE_NAME"
292
+    IMAGE_NAME="$IMAGE_NAME" \
293
+    PROJECT_REPO="$PROJECT_REPO"
287
 
294
 
288
 if [ ! "$?" = "0" ]; then
295
 if [ ! "$?" = "0" ]; then
289
     echo $'Build failed'
296
     echo $'Build failed'

+ 6
- 4
src/freedombone-image-customise Ver arquivo

33
 INSTALL_DIR=/root/build
33
 INSTALL_DIR=/root/build
34
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
34
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
35
 
35
 
36
+PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
37
+
36
 # username created by default within a debian image
38
 # username created by default within a debian image
37
 GENERIC_IMAGE_USERNAME='fbone'
39
 GENERIC_IMAGE_USERNAME='fbone'
38
 
40
 
312
     echo '            shred -zu ~/login.txt' >> $rootdir/root/.bashrc
314
     echo '            shred -zu ~/login.txt' >> $rootdir/root/.bashrc
313
     END_MESSAGE1=$'Congratulations!'
315
     END_MESSAGE1=$'Congratulations!'
314
     if [[ $VARIANT != "mesh" ]]; then
316
     if [[ $VARIANT != "mesh" ]]; then
315
-        END_MESSAGE2=$'\nYour Freedombone system has now installed\n\nThe onion ssh service is at $SSH_ONION_HOSTNAME\n\nPress any key to reboot and begin using it'
317
+        END_MESSAGE2=$'\nYour system has now installed\n\nThe onion ssh service is at $SSH_ONION_HOSTNAME\n\nPress any key to reboot and begin using it'
316
         echo '            SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
318
         echo '            SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
317
     else
319
     else
318
-        END_MESSAGE2=$'\nYour Freedombone system has now installed\n\nPress any key to reboot and begin using it'
320
+        END_MESSAGE2=$'\nYour system has now installed\n\nPress any key to reboot and begin using it'
319
     fi
321
     fi
320
     echo "            dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
322
     echo "            dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
321
     echo '            reboot' >> $rootdir/root/.bashrc
323
     echo '            reboot' >> $rootdir/root/.bashrc
765
 sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
767
 sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
766
 
768
 
767
 chroot "$rootdir" /bin/bash -x <<EOF
769
 chroot "$rootdir" /bin/bash -x <<EOF
768
-git clone https://github.com/bashrc/freedombone /root/freedombone
769
-cd /root/freedombone
770
+git clone $PROJECT_REPO /root/$PROJECT_NAME
771
+cd /root/$PROJECT_NAME
770
 make install
772
 make install
771
 EOF
773
 EOF
772
 
774
 

+ 2
- 0
src/freedombone-image-make Ver arquivo

54
 export MINIMAL_INSTALL
54
 export MINIMAL_INSTALL
55
 export SSH_PORT
55
 export SSH_PORT
56
 export ONION_ONLY
56
 export ONION_ONLY
57
+export PROJECT_REPO
57
 
58
 
58
 # Locate vmdebootstrap program fetched in Makefile
59
 # Locate vmdebootstrap program fetched in Makefile
59
 basedir=`pwd`
60
 basedir=`pwd`
168
 sudo sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" $TEMP_CUSTOMISE
169
 sudo sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" $TEMP_CUSTOMISE
169
 sudo sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" $TEMP_CUSTOMISE
170
 sudo sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" $TEMP_CUSTOMISE
170
 sudo sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" $TEMP_CUSTOMISE
171
 sudo sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" $TEMP_CUSTOMISE
172
+sudo sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" $TEMP_CUSTOMISE
171
 
173
 
172
 echo $"starting $VMDEBOOTSTRAP"
174
 echo $"starting $VMDEBOOTSTRAP"
173
 # Run vmdebootstrap script to create image
175
 # Run vmdebootstrap script to create image

+ 19
- 7
src/freedombone-upgrade Ver arquivo

30
 
30
 
31
 PROJECT_NAME='freedombone'
31
 PROJECT_NAME='freedombone'
32
 
32
 
33
-FREEDOMBONE_REPO="https://github.com/bashrc/${PROJECT_NAME}"
33
+PROJECT_DIR="/root/${PROJECT_NAME}"
34
+
35
+# An optional configuration file which overrides some of these variables
36
+CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg"
37
+
38
+PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
39
+
40
+if [ -f $CONFIGURATION_FILE ]; then
41
+    # read the location of the main project repo
42
+    if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then
43
+        PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
44
+    fi
45
+fi
34
 
46
 
35
 update-ca-certificates
47
 update-ca-certificates
36
 
48
 
37
-if [ ! -d /root/${PROJECT_NAME} ]; then
38
-    git clone $FREEDOMBONE_REPO /root/${PROJECT_NAME}
49
+if [ ! -d $PROJECT_DIR ]; then
50
+    git clone $PROJECT_REPO $PROJECT_DIR
39
 fi
51
 fi
40
 
52
 
41
-if [ -d /root/${PROJECT_NAME} ]; then
42
-    if [ -f /root/${PROJECT_NAME}.cfg ]; then
43
-        cd /root/${PROJECT_NAME}
53
+if [ -d $PROJECT_DIR ]; then
54
+    if [ -f $CONFIGURATION_FILE ]; then
55
+        cd $PROJECT_DIR
44
         git stash
56
         git stash
45
         git pull
57
         git pull
46
         make install
58
         make install
47
-        ${PROJECT_NAME} -c /root/${PROJECT_NAME}.cfg
59
+        ${PROJECT_NAME} -c $CONFIGURATION_FILE
48
     fi
60
     fi
49
 fi
61
 fi
50
 
62