diff --git a/Makefile b/Makefile index ab9f1ad1..c0817aea 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ source: install: mkdir -p ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}/usr/share/${APP}/apps + mkdir -p ${DESTDIR}/usr/share/${APP}/utils mkdir -p ${DESTDIR}/etc/${APP} cp -r image_build/* ${DESTDIR}/etc/${APP} install -m 755 img/backgrounds/${APP}_mesh_background.png ${DESTDIR}${PREFIX}/share @@ -29,6 +30,7 @@ install: install -m 755 src/${APP}-restore-local ${DESTDIR}${PREFIX}/bin/restore install -m 755 src/${APP}-restore-remote ${DESTDIR}${PREFIX}/bin/restorefromfriend mv ${DESTDIR}${PREFIX}/bin/${APP}-app-* ${DESTDIR}/usr/share/${APP}/apps + mv ${DESTDIR}${PREFIX}/bin/${APP}-utils-* ${DESTDIR}/usr/share/${APP}/utils mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/*.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}-backup-local.1.gz ${DESTDIR}${PREFIX}/share/man/man1/backup.1.gz diff --git a/src/freedombone-addcert b/src/freedombone-addcert index c66fb6ac..cda74b4e 100755 --- a/src/freedombone-addcert +++ b/src/freedombone-addcert @@ -36,10 +36,7 @@ export TEXTDOMAINDIR="/usr/share/locale" CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt -source /usr/local/bin/${PROJECT_NAME}-utils-git -if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then - source /usr/bin/${PROJECT_NAME}-utils-git -fi +source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-git HOSTNAME= LETSENCRYPT_HOSTNAME= diff --git a/src/freedombone-adduser b/src/freedombone-adduser index 6f18d1f7..8fcc4c7f 100755 --- a/src/freedombone-adduser +++ b/src/freedombone-adduser @@ -62,14 +62,7 @@ if [ ! -f $COMPLETION_FILE ]; then fi # Minimum number of characters in a password -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})" useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $MY_USERNAME diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index e1b5e8a4..80ea192f 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -48,13 +48,8 @@ if [ -f $CONFIG_FILE ]; then fi # get the version of Go being used -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') - GVM_HOME=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') -else - GO_VERSION=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') - GVM_HOME=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') -fi +GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') +GVM_HOME=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') ADMIN_USERNAME= ADMIN_NAME= diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 54f2c3e8..55cafdc8 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -41,11 +41,7 @@ export TEXTDOMAINDIR="/usr/share/locale" SERVER_DIRECTORY=/root/remotebackup # get the version of Go being used -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') -else - GO_VERSION=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') -fi +GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}') ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1) diff --git a/src/freedombone-config b/src/freedombone-config index e9642579..8435dc3d 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -43,14 +43,7 @@ export TEXTDOMAINDIR="/usr/share/locale" FREEDOMBONE_WEBSITE="http://freedombone.uk.to" # Minimum number of characters in a password -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') # file containing new password IMAGE_PASSWORD_FILE=/root/login.txt diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 06264b35..b6d63e64 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -41,14 +41,7 @@ UPGRADE_SCRIPT_NAME="${PROJECT_NAME}-upgrade" UPDATE_DATE_SCRIPT=/usr/bin/updatedate # Minimum number of characters in a password -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') # voip VOIP_PORT=64738 diff --git a/src/freedombone-image b/src/freedombone-image index 425a4559..c3e2e418 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -76,14 +76,7 @@ CONFIG_FILENAME= DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local" # Minimum number of characters in a password -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') # Optional ssh public key to allow SSH_PUBKEY="no" diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index 66c58127..6c1483fd 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -79,10 +79,7 @@ MESH_INSTALL_DIR=/var/lib REMOVE='no' -source /usr/local/bin/${PROJECT_NAME}-utils-git -if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then - source /usr/bin/${PROJECT_NAME}-utils-git -fi +source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-git function show_help { echo '' diff --git a/src/freedombone-mirrors b/src/freedombone-mirrors index f9d1b940..0ca6d621 100755 --- a/src/freedombone-mirrors +++ b/src/freedombone-mirrors @@ -34,14 +34,7 @@ export TEXTDOMAIN=${PROJECT_NAME}-mirrors export TEXTDOMAINDIR="/usr/share/locale" # Minimum number of characters in a password -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg" @@ -58,7 +51,7 @@ if [ ! -f $MAIN_COMMAND ]; then MAIN_COMMAND=/usr/bin/${PROJECT_NAME} fi -REPOS=($(cat ${MAIN_COMMAND} ${MAIN_COMMAND}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g')) +REPOS=($(cat ${MAIN_COMMAND} /usr/share/${PROJECT_NAME}/utils/${MAIN_COMMAND}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g')) # obtain the mirrors password if it exists diff --git a/src/freedombone-remote b/src/freedombone-remote index b16450e5..ebd213a9 100755 --- a/src/freedombone-remote +++ b/src/freedombone-remote @@ -44,14 +44,7 @@ MY_USERNAME=$USER FRIENDS_SERVERS_LIST= # Minimum password length in characters -MINIMUM_PASSWORD_LENGTH=10 -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/local/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') -else - if [ -f /usr/bin/${PROJECT_NAME} ]; then - MINIMUM_PASSWORD_LENGTH=$(cat /usr/bin/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') - fi -fi +MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}') # How many remote locations were specified entering_remote_backups_ctr=0 diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index d59a2782..972420ea 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -50,13 +50,8 @@ if [ -f $CONFIG_FILE ]; then fi # get the version of Go being used -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') - GVM_HOME=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') -else - GO_VERSION=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') - GVM_HOME=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') -fi +GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') +GVM_HOME=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') ADMIN_USERNAME= ADMIN_NAME= diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index 8600d084..2050d2fc 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -88,11 +88,7 @@ else fi # get the version of Go being used -if [ -f /usr/local/bin/${PROJECT_NAME} ]; then - GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') -else - GO_VERSION=$(cat /usr/bin/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') -fi +GO_VERSION=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-go | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') # MariaDB password DATABASE_PASSWORD=$(cat /root/dbpass) diff --git a/src/freedombone-selector b/src/freedombone-selector index 8755bac8..2bff62e5 100755 --- a/src/freedombone-selector +++ b/src/freedombone-selector @@ -42,7 +42,7 @@ source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt -source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-utils-selector +source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-selector function show_apps { applist="" diff --git a/src/freedombone-upgrade b/src/freedombone-upgrade index b1c38959..2472c7df 100755 --- a/src/freedombone-upgrade +++ b/src/freedombone-upgrade @@ -42,10 +42,7 @@ FRIENDS_MIRRORS_SSH_PORT=2222 FRIENDS_MIRRORS_PASSWORD= MY_MIRRORS_PASSWORD= -source /usr/local/bin/${PROJECT_NAME}-utils-git -if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then - source /usr/bin/${PROJECT_NAME}-utils-git -fi +source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-git function read_repo_servers { if [ -f $CONFIGURATION_FILE ]; then diff --git a/src/freedombone-vars b/src/freedombone-vars index 69fe7bb2..143dacfe 100755 --- a/src/freedombone-vars +++ b/src/freedombone-vars @@ -74,7 +74,7 @@ DEBIAN_VERSION="jessie" ENABLE_SOCIAL_KEY_MANAGEMENT="no" # include utils -UTILS_FILES=$PROJECT_INSTALL_DIR/${PROJECT_NAME}-utils-* +UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-* for f in $UTILS_FILES do source $f