diff --git a/defaults.inc b/defaults.inc index a92e70a..764b886 100755 --- a/defaults.inc +++ b/defaults.inc @@ -20,4 +20,6 @@ LRed='\033[1;31m' +[ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) || + RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) diff --git a/linupx-scripts.sh b/linupx-scripts.sh index 0b58c16..5f935c7 100755 --- a/linupx-scripts.sh +++ b/linupx-scripts.sh @@ -310,6 +310,40 @@ DSMON_INSTALL() { ENTER2CONTINUE esac } +SYNCTHING_INSTALL() { + read -n 1 -p "Are you sure you wish to install Syncthing (Y/n)?" choice + case "$choice" in + [Nn]) INSTALL_MENU;; + * ) + echo + sudo mkdir -p /etc/apt/keyrings + sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg + echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list + ${APTFUNC} update + ${APTFUNC} install syncthing + echo -e "[Unit] +Description=Syncthing - Open Source Continuous File Synchronization for %I +Documentation=man:syncthing(1) +After=network.target + +[Service] +User=root +ExecStart=/usr/bin/syncthing -no-browser -gui-address=\"0.0.0.0:8384\" -no-restart -logflags=0 +Restart=on-failure +SuccessExitStatus=3 4 +RestartForceExitStatus=3 4 + +[Install] +WantedBy=multi-user.target +" > /etc/systemd/system/syncthing.service + systemctl daemon-reload + systemctl enable --now syncthing + echo + echo -e "${idsCL[Green]}Syncthing has been Installed, you can access at http://${RNIP}:8384${idsCL[Default]}" + [ ${action-x} ] && exit 0 + ENTER2CONTINUE + esac +} REMOVEFLOPPY() { echo if [ ! -f /etc/modprobe.d/blacklist-floppy.conf ]; then @@ -991,7 +1025,7 @@ MISC_MENU() { echo echo -e " [${idsCL[Yellow]}5${idsCL[Default]}] Run Storage Speed Tests" echo - if [ "$(IP_ALLOWED `hostname -I`)" == "true" ]; then + if [ "$(IP_ALLOWED ${RNIP})" == "true" ]; then echo -e " [${idsCL[Yellow]}U${idsCL[Default]}] Update copycerts.sh to new LB LE folder path " echo -e " [${idsCL[Yellow]}D${idsCL[Default]}] Update DNS (10.10.10.5, 10.2.1.2)" echo -e " [${idsCL[Yellow]}O${idsCL[Default]}] Update Offsite DNS (10.2.1.2, 10.10.10.5)"