Skip to content
Snippets Groups Projects
Commit 73f46bdc authored by Bob Mottram's avatar Bob Mottram
Browse files

Make the main project repo customisable

So that we're not dependent on github
parent 8bef7061
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,8 @@ PROJECT_NAME='freedombone'
export TEXTDOMAIN=${PROJECT_NAME}-image
export TEXTDOMAINDIR="/usr/share/locale"
PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
# recommended RAM for virtual machines
VM_MEMORY='1G'
......@@ -199,6 +201,10 @@ case $key in
shift
ONION_ONLY="$1"
;;
-r|--repo|--repository)
shift
PROJECT_REPO="$1"
;;
*)
# unknown option
;;
......@@ -283,7 +289,8 @@ make $IMAGE_TYPE \
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
SSH_PORT="$SSH_PORT" \
ONION_ONLY="$ONION_ONLY" \
IMAGE_NAME="$IMAGE_NAME"
IMAGE_NAME="$IMAGE_NAME" \
PROJECT_REPO="$PROJECT_REPO"
if [ ! "$?" = "0" ]; then
echo $'Build failed'
......
......@@ -33,6 +33,8 @@ PROJECT_NAME='freedombone'
INSTALL_DIR=/root/build
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
# username created by default within a debian image
GENERIC_IMAGE_USERNAME='fbone'
......@@ -312,10 +314,10 @@ EOF
echo ' shred -zu ~/login.txt' >> $rootdir/root/.bashrc
END_MESSAGE1=$'Congratulations!'
if [[ $VARIANT != "mesh" ]]; then
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'
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'
echo ' SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
else
END_MESSAGE2=$'\nYour Freedombone system has now installed\n\nPress any key to reboot and begin using it'
END_MESSAGE2=$'\nYour system has now installed\n\nPress any key to reboot and begin using it'
fi
echo " dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
echo ' reboot' >> $rootdir/root/.bashrc
......@@ -765,8 +767,8 @@ chroot "$rootdir" apt-get install -y locales locales-all debconf
sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
chroot "$rootdir" /bin/bash -x <<EOF
git clone https://github.com/bashrc/freedombone /root/freedombone
cd /root/freedombone
git clone $PROJECT_REPO /root/$PROJECT_NAME
cd /root/$PROJECT_NAME
make install
EOF
......
......@@ -54,6 +54,7 @@ export GENERIC_IMAGE
export MINIMAL_INSTALL
export SSH_PORT
export ONION_ONLY
export PROJECT_REPO
# Locate vmdebootstrap program fetched in Makefile
basedir=`pwd`
......@@ -168,6 +169,7 @@ sudo sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" $TEMP_CUSTOMIS
sudo sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" $TEMP_CUSTOMISE
sudo sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" $TEMP_CUSTOMISE
sudo sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" $TEMP_CUSTOMISE
sudo sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" $TEMP_CUSTOMISE
echo $"starting $VMDEBOOTSTRAP"
# Run vmdebootstrap script to create image
......
......@@ -30,21 +30,33 @@
PROJECT_NAME='freedombone'
FREEDOMBONE_REPO="https://github.com/bashrc/${PROJECT_NAME}"
PROJECT_DIR="/root/${PROJECT_NAME}"
# An optional configuration file which overrides some of these variables
CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg"
PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
if [ -f $CONFIGURATION_FILE ]; then
# read the location of the main project repo
if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then
PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
fi
update-ca-certificates
if [ ! -d /root/${PROJECT_NAME} ]; then
git clone $FREEDOMBONE_REPO /root/${PROJECT_NAME}
if [ ! -d $PROJECT_DIR ]; then
git clone $PROJECT_REPO $PROJECT_DIR
fi
if [ -d /root/${PROJECT_NAME} ]; then
if [ -f /root/${PROJECT_NAME}.cfg ]; then
cd /root/${PROJECT_NAME}
if [ -d $PROJECT_DIR ]; then
if [ -f $CONFIGURATION_FILE ]; then
cd $PROJECT_DIR
git stash
git pull
make install
${PROJECT_NAME} -c /root/${PROJECT_NAME}.cfg
${PROJECT_NAME} -c $CONFIGURATION_FILE
fi
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment