diff --git a/auto_install/install.sh b/auto_install/install.sh index 2888b1d..3a22694 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -453,7 +453,7 @@ update_package_cache() { if [ ! "${today}" == "${timestampAsDate}" ]; then #update package lists echo ":::" - echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..." + echo -ne "::: ${PKG_MANAGER} update has not been run today. Running now...\n" $SUDO ${UPDATE_PKG_CACHE} &> /dev/null echo " done!" fi @@ -478,8 +478,23 @@ notify_package_updates_available() { install_bitwarden() { # Install Bitwarden through NPM - this is the preferred installation method since NPM makes it easy to update the package - apt-get install -y nodejs npm - npm install -g @bitwarden/cli + if (whiptail --backtitle "Instal Bitwarden" --title "Install Bitwarden" --yesno "PiVPN Has support for bitwarden password manager, would you like to install it?\n\nNote: this will install nodejs and npm" ${r} ${c}) then + echo "::: Installing Bitwarden" + $SUDO apt-get -qq install nodejs npm + $SUDO npm install -g @bitwarden/cli + if [[ $? -ne 0 ]]; then + BITWARDEN="FAILED" + echo ":: Bitwarden Failed to install, not critical, moving on" + true + else + echo ":: Bitwarden Installed" + BITWARDEN="INSTALLED" + fi + else + echo "::: Bitwarden Skipped" + BITWARDEN="SKIPPED" + fi + } install_dependent_packages() { @@ -1137,6 +1152,7 @@ confOVPN() { $SUDO mkdir "$INSTALL_HOME/ovpns" fi $SUDO chmod 0750 "$INSTALL_HOME/ovpns" + $SUDO chown $INSTALL_USER:$INSTALL_USER "$INSTALL_HOME/ovpns" } confLogging() { @@ -1171,7 +1187,7 @@ if \$programname == 'ovpn-server' then stop" | $SUDO tee /etc/rsyslog.d/30-openv finalExports() { # Update variables in setupVars.conf file if [ -e "${setupVars}" ]; then - $SUDO sed -i.update.bak '/INSTALL_USER/d;/UNATTUPG/d;/pivpnInterface/d;/IPv4dns/d;/IPv4addr/d;/IPv4gw/d;/pivpnProto/d;/PORT/d;/ENCRYPT/d;/DOWNLOAD_DH_PARAM/d;/PUBLICDNS/d;/OVPNDNS1/d;/OVPNDNS2/d;' "${setupVars}" + $SUDO sed -i.update.bak '/INSTALL_USER/d;/UNATTUPG/d;/pivpnInterface/d;/IPv4dns/d;/IPv4addr/d;/IPv4gw/d;/pivpnProto/d;/PORT/d;/ENCRYPT/d;/DOWNLOAD_DH_PARAM/d;/PUBLICDNS/d;/OVPNDNS1/d;/OVPNDNS2/d;/BITWARDEN/d;' "${setupVars}" fi { echo "INSTALL_USER=${INSTALL_USER}" @@ -1188,6 +1204,7 @@ finalExports() { echo "PUBLICDNS=${PUBLICDNS}" echo "OVPNDNS1=${OVPNDNS1}" echo "OVPNDNS2=${OVPNDNS2}" + echo "BITWARDEN=${BITWARDEN}" } | $SUDO tee "${setupVars}" > /dev/null } @@ -1372,8 +1389,6 @@ main() { # Notify user of package availability notify_package_updates_available - # Install packages for Bitwarden - install_bitwarden # Install packages used by this installation script install_dependent_packages PIVPN_DEPS[@] @@ -1444,6 +1459,9 @@ main() { updatePiVPN fi + # Install packages for Bitwarden + install_bitwarden + echo "::: Restarting services..." # Start services case ${PLAT} in diff --git a/scripts/makeOVPN.sh b/scripts/makeOVPN.sh index e31d4ab..e1e7db6 100755 --- a/scripts/makeOVPN.sh +++ b/scripts/makeOVPN.sh @@ -74,7 +74,13 @@ do NO_PASS="1" ;; -b|--bitwarden) - BITWARDEN="2" + if which bw; then + BITWARDEN="2" + else + echo "Bitwarden not found, please install bitwarden" + exit 1 + fi + ;; *) echo "Error: Got an unexpected argument '$1'"