Moving apps to share

This commit is contained in:
Bob Mottram 2016-07-06 19:45:58 +01:00
parent 18d62a43b9
commit 94b3b80aa9
6 changed files with 246 additions and 310 deletions

View File

@ -626,11 +626,7 @@ function mesh_firewall {
function mesh_tox_node { function mesh_tox_node {
# obtain commits from the main file # obtain commits from the main file
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
TOXCORE_COMMIT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
TOXCORE_COMMIT_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then
TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN
fi fi
@ -639,11 +635,7 @@ function mesh_tox_node {
exit 76325 exit 76325
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOX_PORT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
TOX_PORT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
else
TOX_PORT_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ${#TOX_PORT_MAIN} -gt 2 ]; then if [ ${#TOX_PORT_MAIN} -gt 2 ]; then
TOX_PORT=$TOX_PORT_MAIN TOX_PORT=$TOX_PORT_MAIN
fi fi
@ -652,11 +644,7 @@ function mesh_tox_node {
exit 32856 exit 32856
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXCORE_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
TOXCORE_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
else
TOXCORE_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
fi
if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then
TOXCORE_REPO=$TOXCORE_REPO_MAIN TOXCORE_REPO=$TOXCORE_REPO_MAIN
fi fi
@ -767,11 +755,7 @@ function mesh_tox_avahi {
exit 87359 exit 87359
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXID_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
TOXID_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
else
TOXID_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
fi
if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then
TOXID_REPO=$TOXID_REPO_MAIN TOXID_REPO=$TOXID_REPO_MAIN
fi fi
@ -814,27 +798,15 @@ function mesh_tox_avahi {
} }
function mesh_tox_client { function mesh_tox_client {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
# obtain commits from the main file # obtain commits from the main file
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
TOXIC_COMMIT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
TOXIC_COMMIT_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
if [ ${#TOXIC_COMMIT_MAIN} -gt 10 ]; then if [ ${#TOXIC_COMMIT_MAIN} -gt 10 ]; then
TOXIC_COMMIT=$TOXIC_COMMIT_MAIN TOXIC_COMMIT=$TOXIC_COMMIT_MAIN
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_REPO=" | head -n 1 | awk -F '"' '{print $2}')
TOXIC_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_REPO=" | head -n 1 | awk -F '"' '{print $2}')
else
TOXIC_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_REPO=" | head -n 1 | awk -F '"' '{print $2}')
fi
if [ ${#TOXIC_REPO_MAIN} -gt 5 ]; then if [ ${#TOXIC_REPO_MAIN} -gt 5 ]; then
TOXIC_REPO=$TOXIC_REPO_MAIN TOXIC_REPO=$TOXIC_REPO_MAIN
fi fi
@ -858,11 +830,7 @@ function mesh_tox_client {
chmod +x $TEMP_SCRIPT chmod +x $TEMP_SCRIPT
cp $TEMP_SCRIPT $rootdir/root/ cp $TEMP_SCRIPT $rootdir/root/
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
SECONDS=0 SECONDS=0
chroot "$rootdir" /root/$TEMP_SCRIPT_NAME chroot "$rootdir" /root/$TEMP_SCRIPT_NAME
@ -884,11 +852,7 @@ function mesh_tox_client {
function mesh_zeronet { function mesh_zeronet {
# obtain commits from the main file # obtain commits from the main file
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
ZERONET_COMMIT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_COMMIT_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
if [ ${#ZERONET_COMMIT_MAIN} -gt 10 ]; then if [ ${#ZERONET_COMMIT_MAIN} -gt 10 ]; then
ZERONET_COMMIT=$ZERONET_COMMIT_MAIN ZERONET_COMMIT=$ZERONET_COMMIT_MAIN
fi fi
@ -896,12 +860,8 @@ function mesh_zeronet {
echo $'No Tox commit was specified' echo $'No Tox commit was specified'
exit 37046 exit 37046
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_REPO_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_REPO=" | head -n 1 | awk -F '"' '{print $2}')
else
ZERONET_REPO_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_REPO=" | head -n 1 | awk -F '"' '{print $2}')
fi
if [ ${#ZERONET_REPO_MAIN} -gt 5 ]; then if [ ${#ZERONET_REPO_MAIN} -gt 5 ]; then
ZERONET_REPO=$ZERONET_REPO_MAIN ZERONET_REPO=$ZERONET_REPO_MAIN
fi fi
@ -910,11 +870,7 @@ function mesh_zeronet {
exit 37046 exit 37046
fi fi
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_PORT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_PORT=" | head -n 1 | awk -F '=' '{print $2}')
ZERONET_PORT_MAIN=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_PORT=" | head -n 1 | awk -F '=' '{print $2}')
else
ZERONET_PORT_MAIN=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_PORT=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ${#ZERONET_PORT_MAIN} -gt 1 ]; then if [ ${#ZERONET_PORT_MAIN} -gt 1 ]; then
ZERONET_PORT=$ZERONET_PORT_MAIN ZERONET_PORT=$ZERONET_PORT_MAIN
fi fi
@ -995,13 +951,8 @@ function mesh_zeronet {
} }
function mesh_zeronet_blog { function mesh_zeronet_blog {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_BLOG_REPO=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_BLOG_REPO=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}') ZERONET_BLOG_COMMIT=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
ZERONET_BLOG_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_BLOG_REPO=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_BLOG_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog git clone $ZERONET_BLOG_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog
if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
@ -1014,13 +965,8 @@ function mesh_zeronet_blog {
} }
function mesh_zeronet_mail { function mesh_zeronet_mail {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_MAIL_REPO=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_MAIL_REPO=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}') ZERONET_MAIL_COMMIT=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
ZERONET_MAIL_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_MAIL_REPO=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_MAIL_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail git clone $ZERONET_MAIL_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail
if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
@ -1033,13 +979,8 @@ function mesh_zeronet_mail {
} }
function mesh_zeronet_forum { function mesh_zeronet_forum {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_FORUM_REPO=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_FORUM_REPO=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}') ZERONET_FORUM_COMMIT=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
ZERONET_FORUM_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_FORUM_REPO=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_FORUM_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk git clone $ZERONET_FORUM_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk
if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
@ -1052,13 +993,8 @@ function mesh_zeronet_forum {
} }
function mesh_zeronet_id { function mesh_zeronet_id {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then ZERONET_ID_REPO=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_ID_REPO=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}') ZERONET_ID_COMMIT=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
ZERONET_ID_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_ID_REPO=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME}-app-zeronet | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_ID_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID git clone $ZERONET_ID_REPO $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID
if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID ]; then if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet/ZeroID ]; then

View File

@ -372,11 +372,7 @@ function configure_zeronet_id {
function configure_toxcore { function configure_toxcore {
echo $'Configuring toxcore' >> $INSTALL_LOG echo $'Configuring toxcore' >> $INSTALL_LOG
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
echo $'Enabling toxcore daemon' >> $INSTALL_LOG echo $'Enabling toxcore daemon' >> $INSTALL_LOG
systemctl enable tox-bootstrapd.service systemctl enable tox-bootstrapd.service

View File

@ -36,11 +36,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
MUMBLE_PATH=/usr/bin/mumble MUMBLE_PATH=/usr/bin/mumble
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
DHTNODES=/usr/share/toxic/DHTnodes DHTNODES=/usr/share/toxic/DHTnodes
PEERS_FILE=/tmp/meshpeers.txt PEERS_FILE=/tmp/meshpeers.txt

View File

@ -229,11 +229,7 @@ function mesh_avahi {
function install_babel_client { function install_babel_client {
# TODO to be fixed # TODO to be fixed
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ! -f ${rootdir}/tmp/meshtype ]; then if [ ! -f ${rootdir}/tmp/meshtype ]; then
$CHROOT_PREFIX sudo apt-get -y install babeld $CHROOT_PREFIX sudo apt-get -y install babeld

View File

@ -79,6 +79,8 @@ function detect_apps {
APPS_CHOSEN+=("0") APPS_CHOSEN+=("0")
fi fi
done done
function_check get_apps_installed
get_apps_installed get_apps_installed
} }
@ -112,6 +114,8 @@ function choose_apps_for_variant {
fi fi
done done
function_check get_apps_installed
get_apps_installed get_apps_installed
} }

View File

@ -87,250 +87,258 @@ CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/
DH_KEYLENGTH=2048 DH_KEYLENGTH=2048
function initial_setup { function initial_setup {
if grep -Fxq "initial_setup" $COMPLETION_FILE; then if grep -Fxq "initial_setup" $COMPLETION_FILE; then
return return
fi fi
apt-get -y remove --purge apache* apt-get -y remove --purge apache*
apt-get -y dist-upgrade apt-get -y dist-upgrade
apt-get -y install ca-certificates emacs24 cpulimit apt-get -y install ca-certificates emacs24 cpulimit
apt-get -y install cryptsetup libgfshare-bin obnam sshpass wget apt-get -y install cryptsetup libgfshare-bin obnam sshpass wget
apt-get -y install avahi-daemon avahi-utils avahi-discover apt-get -y install avahi-daemon avahi-utils avahi-discover
apt-get -y install connect-proxy apt-get -y install connect-proxy
if [ ! -d $INSTALL_DIR ]; then if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR mkdir -p $INSTALL_DIR
fi fi
echo 'initial_setup' >> $COMPLETION_FILE echo 'initial_setup' >> $COMPLETION_FILE
} }
function search_for_attached_usb_drive { function search_for_attached_usb_drive {
# If a USB drive is attached then search for email, # If a USB drive is attached then search for email,
# gpg, ssh keys and emacs configuration # gpg, ssh keys and emacs configuration
if grep -Fxq "search_for_attached_usb_drive" $COMPLETION_FILE; then if grep -Fxq "search_for_attached_usb_drive" $COMPLETION_FILE; then
return return
fi fi
if [ -b $USB_DRIVE ]; then if [ -b $USB_DRIVE ]; then
if [ ! -d $USB_MOUNT ]; then if [ ! -d $USB_MOUNT ]; then
echo $'Mounting USB drive' echo $'Mounting USB drive'
mkdir $USB_MOUNT mkdir $USB_MOUNT
mount $USB_DRIVE $USB_MOUNT mount $USB_DRIVE $USB_MOUNT
fi fi
if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" || $SYSTEM_TYPE == "$VARIANT_NONMAILBOX" ]]; then if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" || $SYSTEM_TYPE == "$VARIANT_NONMAILBOX" ]]; then
if [ -d $USB_MOUNT/Maildir ]; then if [ -d $USB_MOUNT/Maildir ]; then
echo $'Maildir found on USB drive' echo $'Maildir found on USB drive'
IMPORT_MAILDIR=$USB_MOUNT/Maildir IMPORT_MAILDIR=$USB_MOUNT/Maildir
fi fi
if [ -d $USB_MOUNT/.gnupg ]; then if [ -d $USB_MOUNT/.gnupg ]; then
echo $'Importing GPG keyring' echo $'Importing GPG keyring'
cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
GPG_KEYS_IMPORTED="yes" GPG_KEYS_IMPORTED="yes"
if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
echo $'GPG files did not copy' echo $'GPG files did not copy'
exit 73529 exit 73529
fi fi
fi fi
if [ -f $USB_MOUNT/.procmailrc ]; then if [ -f $USB_MOUNT/.procmailrc ]; then
echo $'Importing procmail settings' echo $'Importing procmail settings'
cp $USB_MOUNT/.procmailrc /home/$MY_USERNAME cp $USB_MOUNT/.procmailrc /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
fi fi
if [ -f $USB_MOUNT/private_key.gpg ]; then if [ -f $USB_MOUNT/private_key.gpg ]; then
echo $'GPG private key found on USB drive' echo $'GPG private key found on USB drive'
MY_GPG_PRIVATE_KEY=$USB_MOUNT/private_key.gpg MY_GPG_PRIVATE_KEY=$USB_MOUNT/private_key.gpg
fi fi
if [ -f $USB_MOUNT/public_key.gpg ]; then if [ -f $USB_MOUNT/public_key.gpg ]; then
echo $'GPG public key found on USB drive' echo $'GPG public key found on USB drive'
MY_GPG_PUBLIC_KEY=$USB_MOUNT/public_key.gpg MY_GPG_PUBLIC_KEY=$USB_MOUNT/public_key.gpg
fi fi
fi fi
if [ -d $USB_MOUNT/prosody ]; then if [ -d $USB_MOUNT/prosody ]; then
if [ ! -d $XMPP_DIRECTORY ]; then if [ ! -d $XMPP_DIRECTORY ]; then
mkdir $XMPP_DIRECTORY mkdir $XMPP_DIRECTORY
fi fi
cp -r $USB_MOUNT/prosody/* $XMPP_DIRECTORY cp -r $USB_MOUNT/prosody/* $XMPP_DIRECTORY
chown -R prosody:prosody $XMPP_DIRECTORY chown -R prosody:prosody $XMPP_DIRECTORY
fi fi
if [ -d $USB_MOUNT/.ssh ]; then if [ -d $USB_MOUNT/.ssh ]; then
echo $'Importing ssh keys' echo $'Importing ssh keys'
cp -r $USB_MOUNT/.ssh /home/$MY_USERNAME cp -r $USB_MOUNT/.ssh /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
# for security delete the ssh keys from the usb drive # for security delete the ssh keys from the usb drive
if [ ! -f /home/$MY_USERNAME/.ssh/id_rsa ]; then if [ ! -f /home/$MY_USERNAME/.ssh/id_rsa ]; then
echo $'ssh files did not copy' echo $'ssh files did not copy'
exit 8 exit 8
fi fi
fi fi
if [ -f $USB_MOUNT/.emacs ]; then if [ -f $USB_MOUNT/.emacs ]; then
echo $'Importing .emacs file' echo $'Importing .emacs file'
cp -f $USB_MOUNT/.emacs /home/$MY_USERNAME/.emacs cp -f $USB_MOUNT/.emacs /home/$MY_USERNAME/.emacs
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
fi fi
if [ -d $USB_MOUNT/.emacs.d ]; then if [ -d $USB_MOUNT/.emacs.d ]; then
echo $'Importing .emacs.d directory' echo $'Importing .emacs.d directory'
cp -r $USB_MOUNT/.emacs.d /home/$MY_USERNAME cp -r $USB_MOUNT/.emacs.d /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d
fi fi
if [ -d $USB_MOUNT/ssl ]; then if [ -d $USB_MOUNT/ssl ]; then
echo $'Importing SSL certificates' echo $'Importing SSL certificates'
cp -r $USB_MOUNT/ssl/* /etc/ssl cp -r $USB_MOUNT/ssl/* /etc/ssl
chmod 640 /etc/ssl/certs/* chmod 640 /etc/ssl/certs/*
chmod 400 /etc/ssl/private/* chmod 400 /etc/ssl/private/*
# change ownership of some certificates # change ownership of some certificates
if [ -d /etc/prosody ]; then if [ -d /etc/prosody ]; then
chown prosody:prosody /etc/ssl/private/xmpp.* chown prosody:prosody /etc/ssl/private/xmpp.*
chown prosody:prosody /etc/ssl/certs/xmpp.* chown prosody:prosody /etc/ssl/certs/xmpp.*
fi fi
if [ -d /etc/dovecot ]; then if [ -d /etc/dovecot ]; then
chown root:dovecot /etc/ssl/certs/dovecot.* chown root:dovecot /etc/ssl/certs/dovecot.*
chown root:dovecot /etc/ssl/private/dovecot.* chown root:dovecot /etc/ssl/private/dovecot.*
fi fi
if [ -f /etc/ssl/private/exim.key ]; then if [ -f /etc/ssl/private/exim.key ]; then
cp /etc/ssl/private/exim.key /etc/exim4 cp /etc/ssl/private/exim.key /etc/exim4
cp /etc/ssl/certs/exim.crt /etc/exim4 cp /etc/ssl/certs/exim.crt /etc/exim4
cp /etc/ssl/certs/exim.dhparam /etc/exim4 cp /etc/ssl/certs/exim.dhparam /etc/exim4
chown root:Debian-exim /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam chown root:Debian-exim /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
fi fi
fi fi
if [ -d $USB_MOUNT/personal ]; then if [ -d $USB_MOUNT/personal ]; then
echo $'Importing personal directory' echo $'Importing personal directory'
cp -r $USB_MOUNT/personal /home/$MY_USERNAME cp -r $USB_MOUNT/personal /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal
fi fi
else else
if [ -d $USB_MOUNT ]; then if [ -d $USB_MOUNT ]; then
umount $USB_MOUNT umount $USB_MOUNT
rm -rf $USB_MOUNT rm -rf $USB_MOUNT
fi fi
echo $'No USB drive attached' echo $'No USB drive attached'
fi fi
echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
} }
function mark_admin_user_account { function mark_admin_user_account {
if ! grep -q "Admin user:" $COMPLETION_FILE; then if ! grep -q "Admin user:" $COMPLETION_FILE; then
echo "Admin user:$MY_USERNAME" >> $COMPLETION_FILE echo "Admin user:$MY_USERNAME" >> $COMPLETION_FILE
fi fi
} }
function remove_instructions_from_motd { function remove_instructions_from_motd {
sed -i '/## /d' /etc/motd sed -i '/## /d' /etc/motd
} }
function remove_default_user { function remove_default_user {
# make sure you don't use the default user account # make sure you don't use the default user account
if [[ $MY_USERNAME == "debian" ]]; then if [[ $MY_USERNAME == "debian" ]]; then
echo 'Do not use the default debian user account. Create a different user with: adduser [username]' echo 'Do not use the default debian user account. Create a different user with: adduser [username]'
exit 68 exit 68
fi fi
# remove the default debian user to prevent it from becoming an attack vector # remove the default debian user to prevent it from becoming an attack vector
if [ -d /home/debian ]; then if [ -d /home/debian ]; then
userdel -r debian userdel -r debian
echo 'Default debian user account removed' echo 'Default debian user account removed'
fi fi
}
function upgrade_installation {
if [ ! -d /usr/share/${PROJECT_NAME}/apps ]; then
mkdir -p /usr/share/${PROJECT_NAME}/apps
fi
mv /usr/local/bin/${PROJECT_NAME}-app-* /usr/share/${PROJECT_NAME}/apps
} }
function setup_firewall { function setup_firewall {
configure_firewall configure_firewall
configure_firewall_ping configure_firewall_ping
configure_firewall_for_dns configure_firewall_for_dns
configure_firewall_for_avahi configure_firewall_for_avahi
} }
function setup_utils { function setup_utils {
read_configuration read_configuration
set_default_onion_domains upgrade_installation
locale_setup set_default_onion_domains
parse_args locale_setup
check_domains parse_args
install_static_network check_domains
remove_default_user install_static_network
setup_firewall remove_default_user
create_repo_sources setup_firewall
configure_dns create_repo_sources
initial_setup configure_dns
install_tor initial_setup
#resolve_dns_via_tor install_tor
install_command_line_browser #resolve_dns_via_tor
enable_ssh_via_onion install_command_line_browser
check_date enable_ssh_via_onion
install_dynamicdns check_date
randomize_cron install_dynamicdns
create_freedns_updater randomize_cron
mark_admin_user_account create_freedns_updater
enforce_good_passwords mark_admin_user_account
install_editor enforce_good_passwords
change_login_message install_editor
enable_zram change_login_message
random_number_generator enable_zram
set_your_domain_name random_number_generator
time_synchronisation_tlsdate set_your_domain_name
configure_internet_protocol time_synchronisation_tlsdate
create_git_project configure_internet_protocol
setup_wifi create_git_project
configure_ssh setup_wifi
configure_ssh_onion configure_ssh
allow_ssh_to_onion_address configure_ssh_onion
remove_instructions_from_motd allow_ssh_to_onion_address
check_hwrng remove_instructions_from_motd
search_for_attached_usb_drive check_hwrng
regenerate_ssh_keys search_for_attached_usb_drive
create_mirrors regenerate_ssh_keys
create_upgrade_script create_mirrors
letsencrypt_renewals create_upgrade_script
install_watchdog_script letsencrypt_renewals
configure_avahi install_watchdog_script
create_avahi_onion_domains configure_avahi
#install_atheros_wifi create_avahi_onion_domains
route_outgoing_traffic_through_tor #install_atheros_wifi
upgrade_golang route_outgoing_traffic_through_tor
upgrade_golang
} }
function setup_email { function setup_email {
install_email install_email
create_procmail create_procmail
handle_admin_emails handle_admin_emails
spam_filtering spam_filtering
configure_imap configure_imap
#configure_imap_client_certs #configure_imap_client_certs
configure_gpg configure_gpg
refresh_gpg_keys refresh_gpg_keys
configure_backup_key configure_backup_key
install_monkeysphere install_monkeysphere
encrypt_incoming_email encrypt_incoming_email
encrypt_outgoing_email encrypt_outgoing_email
email_client email_client
email_archiving email_archiving
email_from_address email_from_address
create_public_mailing_list create_public_mailing_list
#create_private_mailing_list #create_private_mailing_list
encrypt_all_email encrypt_all_email
import_email import_email
} }
function setup_web { function setup_web {
install_web_server install_web_server
install_web_server_access_control install_web_server_access_control
} }
function setup_apps { function setup_apps {
function_check choose_apps_for_variant function_check choose_apps_for_variant
choose_apps_for_variant "$SYSTEM_TYPE" choose_apps_for_variant "$SYSTEM_TYPE"
echo $"System variant: $SYSTEM_TYPE" echo $"System variant: $SYSTEM_TYPE"
echo $'The following apps have been selected' echo $'The following apps have been selected'
echo '' echo ''
function_check list_chosen_apps function_check list_chosen_apps
list_chosen_apps list_chosen_apps
echo '' echo ''
function_check install_apps function_check install_apps
install_apps install_apps
} }
# NOTE: deliberately no exit 0 # NOTE: deliberately no exit 0