diff --git a/back/update_vendors.sh b/back/update_vendors.sh index ec6aa5c5..7ce6c4f1 100755 --- a/back/update_vendors.sh +++ b/back/update_vendors.sh @@ -20,15 +20,15 @@ echo "---------------------------------------------------------" # ---------------------------------------------------------------------- echo Updating... /usr/share/ieee-data/ -cd /usr/share/ieee-data/ +cd /usr/share/ieee-data/ || { echo "could not enter /usr/share/ieee-data directory"; exit 1; } sudo mkdir -p 2_backup -sudo cp *.txt 2_backup -sudo cp *.csv 2_backup +sudo cp -- *.txt 2_backup +sudo cp -- *.csv 2_backup echo "" echo Download Start echo "" -sudo curl $1 -LO https://standards-oui.ieee.org/iab/iab.csv \ +sudo curl "$1" -LO https://standards-oui.ieee.org/iab/iab.csv \ -LO https://standards-oui.ieee.org/iab/iab.txt \ -LO https://standards-oui.ieee.org/oui28/mam.csv \ -LO https://standards-oui.ieee.org/iab/iab.txt \ @@ -44,10 +44,10 @@ echo Download Finished # ---------------------------------------------------------------------- echo "" echo Updating... /usr/share/arp-scan/ -cd /usr/share/arp-scan +cd /usr/share/arp-scan || { echo "could not enter /usr/share/arp-scan directory"; exit 1; } sudo mkdir -p 2_backup -sudo cp *.txt 2_backup +sudo cp -- *.txt 2_backup # Update from /usb/lib/ieee-data sudo get-iab -v diff --git a/dockerfiles/start.sh b/dockerfiles/start.sh index 252e6ff5..1c5bc001 100755 --- a/dockerfiles/start.sh +++ b/dockerfiles/start.sh @@ -31,7 +31,7 @@ echo "[INSTALL] Run setup scripts" # Change port number if set if [ -n "${PORT}" ]; then - sed -ie 's/listen 20211/listen '${PORT}'/g' /etc/nginx/sites-available/default + sed -ie 's/listen 20211/listen '"${PORT}"'/g' /etc/nginx/sites-available/default fi echo "[INSTALL] Setup NGINX" @@ -60,7 +60,7 @@ fi # Change web interface address if set if [ -n "${LISTEN_ADDR}" ]; then - sed -ie 's/listen /listen '${LISTEN_ADDR}:'/g' /etc/nginx/conf.d/pialert.conf + sed -ie 's/listen /listen '"${LISTEN_ADDR}":'/g' /etc/nginx/conf.d/pialert.conf fi # Run the hardware vendors update at least once diff --git a/dockerfiles/user-mapping.sh b/dockerfiles/user-mapping.sh index 40dd4ec2..eeff48bd 100755 --- a/dockerfiles/user-mapping.sh +++ b/dockerfiles/user-mapping.sh @@ -9,7 +9,7 @@ if [ -z "${USER}" ]; then fi # if both not set we do not need to do anything -if [ -z "${HOST_USER_ID}" -a -z "${HOST_USER_GID}" ]; then +if [ -z "${HOST_USER_ID}" ] && [ -z "${HOST_USER_GID}" ]; then echo "Nothing to do here." ; exit 0 fi @@ -20,20 +20,20 @@ USER_GID=${HOST_USER_GID:=$USER_GID} LINE=$(grep -F "${USER}" /etc/passwd) # replace all ':' with a space and create array -array=( ${LINE//:/ } ) +array=( "${LINE//:/ }" ) # home is 5th element USER_HOME=${array[4]} # print debug output -echo USER_ID : ${USER_ID}; -echo USER_GID : ${USER_GID}; -echo USER_HOME: ${USER_HOME}; -echo TZ : ${TZ}; +echo USER_ID" ": "${USER_ID}"; +echo USER_GID : "${USER_GID}"; +echo USER_HOME: "${USER_HOME}"; +echo TZ" ": "${TZ}"; sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:[0-9]*/${USER}:\1:${USER_ID}:${USER_GID}/" /etc/passwd sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group -chown -R ${USER_ID}:${USER_GID} ${USER_HOME} +chown -R "${USER_ID}:${USER_GID} ${USER_HOME}" -exec su - "${USER}" \ No newline at end of file +exec su - "${USER}" diff --git a/install/install.sh b/install/install.sh index 1e9ccca6..05900535 100755 --- a/install/install.sh +++ b/install/install.sh @@ -26,6 +26,10 @@ rm -R $INSTALL_DIR/pialert # Clone the application repository git clone https://github.com/jokob-sk/Pi.Alert "$INSTALL_DIR/pialert" +# Check for buildtimestamp.txt existence, otherwise create it +if [ ! -f /home/pi/pialert/front/buildtimestamp.txt ]; then + date +%s > /home/pi/pialert/front/buildtimestamp.txt +fi # Start PiAlert "$INSTALL_DIR/pialert/dockerfiles/start.sh"