From 706dc5faca30d841be9be05cf757e72525540344 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 12:48:35 +0200 Subject: :hammer: Fix permission issue --- bin/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 25c5dc8..c2e2cdf 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -106,13 +106,13 @@ tput sgr0 tput setaf 8 printf '%s\n' " - Creating user 'lux-neo'..." username="lux-neo" -egrep "^$username" /etc/passwd >/dev/null +sudo egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then echo "$username exists!" exit 1 else #pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) - useradd -m $username + sudo useradd -m $username [ $? -eq 0 ] && echo "User has been added to system!" || { printf "\n\nInstall failed.\n"; exit 1; } fi tput sgr0 -- cgit v1.2.3 From 2a0d442014041e0f4a0c6aed5a02980ab770cfce Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 13:08:47 +0200 Subject: :construction: Work on lux-neo user with install --- bin/install.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index c2e2cdf..e227b88 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -105,6 +105,7 @@ tput sgr0 # Create user 'luxcena-neo' tput setaf 8 printf '%s\n' " - Creating user 'lux-neo'..." +tput sgr0 username="lux-neo" sudo egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then @@ -115,27 +116,27 @@ else sudo useradd -m $username [ $? -eq 0 ] && echo "User has been added to system!" || { printf "\n\nInstall failed.\n"; exit 1; } fi -tput sgr0 -# Change to the new user -tput setaf 8 -printf '%s\n' " - Changing to new user..." -sudo su lux-neo -tput sgr0 + +userDir=$(eval echo "~$username") # First we make our directories tput setaf 8 printf '%s\n' " - Making app-dir (/bin/luxcena-neo)..." tput sgr0 -mkdir ~/install || { printf "\n\nInstall failed.\n"; exit 1; } -mkdir ~/install/src || { printf "\n\nInstall failed.\n"; exit 1; } -mkdir ~/install/userdata || { printf "\n\nInstall failed.\n"; exit 1; } +sudo mkdir -p "$userDir/install" || { printf "\n\nInstall failed.\n"; exit 1; } +sudo chown $username:$username "$userDir/install" +sudo mkdir -p "$userDir/install/src" || { printf "\n\nInstall failed.\n"; exit 1; } +sudo chown $username:$username "$userDir/install/src" +sudo mkdir -p "$userDir/install/userdata" || { printf "\n\nInstall failed.\n"; exit 1; } +sudo chown $username:$username "$userDir/install/userdata" # Third we copy the source into the correct swap-folder tput setaf 8 printf '%s\n' " - Copying sourceCode to app-dir..." tput sgr0 -cp -r . ~/install/src || { printf "\n\nInstall failed.\n"; exit 1; } +sudo cp -r . "$userDir/install/src" || { printf "\n\nInstall failed.\n"; exit 1; } +sudo chown -R $username:$username "$userDir/install/src" # fourth we run npm i tput setaf 8 @@ -143,7 +144,7 @@ printf '%s\n' " - Running npm i..." tput sgr0 tput sc export NODE_ENV=production || { printf "\n\nInstall failed.\n"; exit 1; } -npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; } # This is probably a bit overkill to have --only=... but better safe than sorry? +runuser -l $username -c "npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }" # This is probably a bit overkill to have --only=... but better safe than sorry? tput rc; tput ed # Fifth we add the service files -- cgit v1.2.3 From f36d99a3c960b7d6eaf95e23bea49dc02f1f3ae6 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 13:13:27 +0200 Subject: :construction: Add sudo to runuser, just continue if user exists --- bin/install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index e227b88..24526f2 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -109,8 +109,7 @@ tput sgr0 username="lux-neo" sudo egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then - echo "$username exists!" - exit 1 + echo "User already exists, continuing..." else #pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) sudo useradd -m $username @@ -144,7 +143,7 @@ printf '%s\n' " - Running npm i..." tput sgr0 tput sc export NODE_ENV=production || { printf "\n\nInstall failed.\n"; exit 1; } -runuser -l $username -c "npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }" # This is probably a bit overkill to have --only=... but better safe than sorry? +sudo runuser -l $username -c "npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }" # This is probably a bit overkill to have --only=... but better safe than sorry? tput rc; tput ed # Fifth we add the service files -- cgit v1.2.3 From fd8c13982dd46008de7258676f06cfca3d80b953 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 16:05:55 +0200 Subject: :fire: Delete no longer needed user-check --- bin/install.sh | 5 ----- 1 file changed, 5 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 24526f2..4ba4e45 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -5,11 +5,6 @@ printf '%s\n' "Luxcena-neo Installer" tput sgr0 printf '\e[93m%s\e[0m\n\n' "---------------------" -if [ $USER != "pi" ]; then - printf "Install failed...\nOther user than 'pi' detected. If you want to use another user, you have to install manually." - exit 1 -fi - # Update system tput sc tput setaf 4 -- cgit v1.2.3 From 4a4a950ea94d460c9afd3d8062b377c18e977963 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 16:26:26 +0200 Subject: :hammer: Move yes/no dialog to function --- bin/install.sh | 141 ++++++++++++++++++++++++--------------------------------- 1 file changed, 60 insertions(+), 81 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 4ba4e45..289f48e 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -5,93 +5,70 @@ printf '%s\n' "Luxcena-neo Installer" tput sgr0 printf '\e[93m%s\e[0m\n\n' "---------------------" +function dlgYN() { + tput sc + tput setaf 4 + printf "$1 (y/n)? " + while : + do + read -n 1 -p "" YNQuestionAnswer + if [[ $YNQuestionAnswer == "y" ]]; then + tput rc; tput el + printf ". $1?: \e[0;32mYes\e[0m\n" + tput sc + eval $2=1 # Set parameter 2 of input to the return value + break + elif [[ $YNQuestionAnswer == "n" ]]; then + tput rc; tput el + printf ". $1?: \e[0;31mNo\e[0m\n" + eval $2=0 # Set parameter 2 of input to the return value + break + fi + done +} + # Update system -tput sc -tput setaf 4 -printf ". Update your system (y/n)? " -while : -do - read -n 1 -p "" YNQuestionAnswer - if [[ $YNQuestionAnswer == "y" ]]; then - tput rc; tput el - printf ". Update your system?: \e[0;32mYes\e[0m\n" - tput sc - sudo apt-get -y -qq update || { printf "\n\nInstall failed.\n"; exit 1; } - sudo apt-get -y -qq upgrade || { printf "\n\nInstall failed.\n"; exit 1; } - tput rc; tput ed - break - elif [[ $YNQuestionAnswer == "n" ]]; then - tput rc; tput el - printf ". Update your system?: \e[0;31mNo\e[0m\n" - break - fi -done +dlgYN ". Update your system" res +if [ $res -eq 1 ]; then + tput sc + sudo apt-get -y -qq update || { printf "\n\nInstall failed.\n"; exit 1; } + sudo apt-get -y -qq upgrade || { printf "\n\nInstall failed.\n"; exit 1; } + tput rc; tput ed +fi # Install packages -tput sc -tput setaf 4 -printf ". Install required packages (y/n)? " -while : -do - read -n 1 -p "" YNQuestionAnswer - if [[ $YNQuestionAnswer == "y" ]]; then - tput rc; tput el - printf ". Install required packages?: \e[0;32mYes\e[0m\n" - tput sc - sudo apt-get -y -qq install nodejs scons python-dev swig || { printf "\n\nInstall failed.\n"; exit 1; } - if [ $? -eq 0 ]; then - tput rc; tput ed - printf "✓" - else - printf "\nInstall failed.\n" - exit 1 - fi - break - elif [[ $YNQuestionAnswer == "n" ]]; then - tput rc; tput el - printf ". Install required packages?: \e[0;31mNo\e[0m\n" - tput setaf 2 - printf " We are now assuming that all the following packages exists on your system:\n" - printf " nodejs scons python-dev swig\n" - tput sgr0 - break +dlgYN ". Install required packages" res +if [ $res -eq 1 ]; then + tput sc + sudo apt-get -y -qq install nodejs scons python-dev swig || { printf "\n\nInstall failed.\n"; exit 1; } + if [ $? -eq 0 ]; then + tput rc; tput ed + printf "✓" + else + printf "\nInstall failed.\n" + exit 1 fi -done +else + tput setaf 2 + printf " We are now assuming that all the following packages exists on your system:\n" + printf " nodejs scons python-dev swig\n" + tput sgr0 +fi # Install led-library -tput sc -tput setaf 4 -printf ". Install jgarff's rpi_ws281x library (y/n)? " -while : -do - read -n 1 -p "" YNQuestionAnswer - if [[ $YNQuestionAnswer == "y" ]]; then - tput rc; tput el - printf ". Install jgarff's rpi_ws281x library?: \e[0;32mYes\e[0m\n" - tput sc - git clone https://github.com/jgarff/rpi_ws281x /tmp/rpi_ws281x # TODO CHANGE PATH - python /tmp/rpi_ws281x/python/setup.py install # TODO CHANGE PAHT - if [ $? -eq 0 ]; then - tput rc; tput ed - printf "✓" - else - printf "\nInstall failed.\n" - exit 1 - fi - break - elif [[ $YNQuestionAnswer == "n" ]]; then - tput rc; tput el - printf ". Install jgarff's rpi_ws281x library?: \e[0;31mNo\e[0m\n" - break +dlgYN ". Install jgarff's rpi_ws281x library" res +if [ $res -eq 1 ]; then + tput sc + git clone https://github.com/jgarff/rpi_ws281x /tmp/rpi_ws281x # TODO CHANGE PATH + python /tmp/rpi_ws281x/python/setup.py install # TODO CHANGE PAHT + if [ $? -eq 0 ]; then + tput rc; tput ed + printf "✓" + else + printf "\nInstall failed.\n" + exit 1 fi -done - - -tput setaf 4 -printf ". Which rPi is this? (j:↓, k:↑, ↩:↩)\n" -tput sgr0 -tput sc -tput bel +fi tput setaf 4 printf ". Installing the app itself...\n" @@ -138,7 +115,9 @@ printf '%s\n' " - Running npm i..." tput sgr0 tput sc export NODE_ENV=production || { printf "\n\nInstall failed.\n"; exit 1; } -sudo runuser -l $username -c "npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }" # This is probably a bit overkill to have --only=... but better safe than sorry? +sudo runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }' # This is probably a bit overkill to have --only=... but better safe than sorry? +if [ $? -eq 0 ]; then +fi tput rc; tput ed # Fifth we add the service files -- cgit v1.2.3 From 0c0561b98528d01faf0d7d6ab5a9324609284aaf Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 16:29:48 +0200 Subject: :bug: Fix syntax, check function success with it's own if --- bin/install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 289f48e..08f160b 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -115,8 +115,10 @@ printf '%s\n' " - Running npm i..." tput sgr0 tput sc export NODE_ENV=production || { printf "\n\nInstall failed.\n"; exit 1; } -sudo runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production || { printf "\n\nInstall failed.\n"; exit 1; }' # This is probably a bit overkill to have --only=... but better safe than sorry? -if [ $? -eq 0 ]; then +sudo runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production' # This is probably a bit overkill to have --only=... but better safe than sorry? +if [ $? -ne 0 ]; then + printf "\n\nInstall failed.\n" + exit 1 fi tput rc; tput ed -- cgit v1.2.3 From a74ee07f77d6434b907d8e560c65468ea04336e6 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 20:32:36 +0200 Subject: :construction: Fix error message on adduser error --- bin/install.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 08f160b..ae45052 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -84,17 +84,14 @@ if [ $? -eq 0 ]; then echo "User already exists, continuing..." else #pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) - sudo useradd -m $username - [ $? -eq 0 ] && echo "User has been added to system!" || { printf "\n\nInstall failed.\n"; exit 1; } + sudo useradd -m $username || { printf "\n\nInstall failed.\n"; exit 1; } fi - -userDir=$(eval echo "~$username") - # First we make our directories tput setaf 8 printf '%s\n' " - Making app-dir (/bin/luxcena-neo)..." tput sgr0 +userDir=$(eval echo "~$username") sudo mkdir -p "$userDir/install" || { printf "\n\nInstall failed.\n"; exit 1; } sudo chown $username:$username "$userDir/install" sudo mkdir -p "$userDir/install/src" || { printf "\n\nInstall failed.\n"; exit 1; } -- cgit v1.2.3 From 90ffcddf7e861dcdaab5a0612146ce8292d75c60 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 20:56:18 +0200 Subject: :construction: Remove 'sudos' from install script, and assume root --- bin/install.sh | 58 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 21 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index ae45052..62077a7 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -5,6 +5,26 @@ printf '%s\n' "Luxcena-neo Installer" tput sgr0 printf '\e[93m%s\e[0m\n\n' "---------------------" +LOG="/tmp/luxcena-neo.install.log" +touch $LOG +echo "Starting Luxcena-neo installer..." >> LOG + +if [ "$EUID" -ne 0 ]; then + echo "You need to run this script as root." + echo "Try running with 'sudo ./bin/install.sh'" + exit 1 +fi + +function die() { + tput setaf 1 + printf "\n\nInstall failed.\n" + printf "Check the logfile at '/tmp/lucxena-neo.install.log'.\n" + printf "Use this command to see the last 30 lines of the file;\n" + printf " tail -n 30 /tmp/luxcena-neo.install.log" + tput sgr0 + exit 1 +} + function dlgYN() { tput sc tput setaf 4 @@ -31,8 +51,8 @@ function dlgYN() { dlgYN ". Update your system" res if [ $res -eq 1 ]; then tput sc - sudo apt-get -y -qq update || { printf "\n\nInstall failed.\n"; exit 1; } - sudo apt-get -y -qq upgrade || { printf "\n\nInstall failed.\n"; exit 1; } + apt-get -y -qq update >> LOG || die + apt-get -y -qq upgrade >> LOG || die tput rc; tput ed fi @@ -40,7 +60,7 @@ fi dlgYN ". Install required packages" res if [ $res -eq 1 ]; then tput sc - sudo apt-get -y -qq install nodejs scons python-dev swig || { printf "\n\nInstall failed.\n"; exit 1; } + apt-get -y -qq install nodejs scons python-dev swig >> LOG || die if [ $? -eq 0 ]; then tput rc; tput ed printf "✓" @@ -79,12 +99,12 @@ tput setaf 8 printf '%s\n' " - Creating user 'lux-neo'..." tput sgr0 username="lux-neo" -sudo egrep "^$username" /etc/passwd >/dev/null +egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then echo "User already exists, continuing..." else #pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) - sudo useradd -m $username || { printf "\n\nInstall failed.\n"; exit 1; } + useradd -m $username >> LOG || die fi # First we make our directories @@ -92,39 +112,35 @@ tput setaf 8 printf '%s\n' " - Making app-dir (/bin/luxcena-neo)..." tput sgr0 userDir=$(eval echo "~$username") -sudo mkdir -p "$userDir/install" || { printf "\n\nInstall failed.\n"; exit 1; } -sudo chown $username:$username "$userDir/install" -sudo mkdir -p "$userDir/install/src" || { printf "\n\nInstall failed.\n"; exit 1; } -sudo chown $username:$username "$userDir/install/src" -sudo mkdir -p "$userDir/install/userdata" || { printf "\n\nInstall failed.\n"; exit 1; } -sudo chown $username:$username "$userDir/install/userdata" +mkdir -p "$userDir/install" >> LOG || die +chown $username:$username "$userDir/install" >> LOG || die +mkdir -p "$userDir/install/src" >> LOG || die +chown $username:$username "$userDir/install/src" >> LOG || die +mkdir -p "$userDir/install/userdata" >> LOG || die +chown $username:$username "$userDir/install/userdata" >> LOG || die # Third we copy the source into the correct swap-folder tput setaf 8 printf '%s\n' " - Copying sourceCode to app-dir..." tput sgr0 -sudo cp -r . "$userDir/install/src" || { printf "\n\nInstall failed.\n"; exit 1; } -sudo chown -R $username:$username "$userDir/install/src" +cp -r . "$userDir/install/src" >> LOG || die +chown -R $username:$username "$userDir/install/src" >> LOG || die # fourth we run npm i tput setaf 8 printf '%s\n' " - Running npm i..." tput sgr0 tput sc -export NODE_ENV=production || { printf "\n\nInstall failed.\n"; exit 1; } -sudo runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production' # This is probably a bit overkill to have --only=... but better safe than sorry? -if [ $? -ne 0 ]; then - printf "\n\nInstall failed.\n" - exit 1 -fi +export NODE_ENV=production >> LOG || die +runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production' >> LOG || die # This is probably a bit overkill to have --only=... but better safe than sorry? tput rc; tput ed # Fifth we add the service files tput setaf 8 printf '%s\n' " - Adding service-file to systemd..." tput sgr0 -sudo cp bin/luxcena-neo.service /etc/systemd/system/luxcena-neo.service -sudo systemctl daemon-reload +cp bin/luxcena-neo.service /etc/systemd/system/luxcena-neo.service >> LOG || die +systemctl daemon-reload >> LOG || die # Installation is done! printf '\n\e[5m%s\e[0m\n' "🎉Luxcena-Neo is now installed🎉" -- cgit v1.2.3 From 3dd9774e5d76447465b10023af42c01286093424 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 21:03:48 +0200 Subject: :construction: Redirect ALL output to the LOGFILE and not 'LOG' --- bin/install.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 62077a7..e9c79cd 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -7,7 +7,7 @@ printf '\e[93m%s\e[0m\n\n' "---------------------" LOG="/tmp/luxcena-neo.install.log" touch $LOG -echo "Starting Luxcena-neo installer..." >> LOG +echo "Starting Luxcena-neo installer..." &>> $LOG if [ "$EUID" -ne 0 ]; then echo "You need to run this script as root." @@ -51,8 +51,8 @@ function dlgYN() { dlgYN ". Update your system" res if [ $res -eq 1 ]; then tput sc - apt-get -y -qq update >> LOG || die - apt-get -y -qq upgrade >> LOG || die + apt-get -y -qq update &>> $LOG || die + apt-get -y -qq upgrade &>> $LOG || die tput rc; tput ed fi @@ -60,7 +60,7 @@ fi dlgYN ". Install required packages" res if [ $res -eq 1 ]; then tput sc - apt-get -y -qq install nodejs scons python-dev swig >> LOG || die + apt-get -y -qq install nodejs scons python-dev swig &>> $LOG || die if [ $? -eq 0 ]; then tput rc; tput ed printf "✓" @@ -104,7 +104,7 @@ if [ $? -eq 0 ]; then echo "User already exists, continuing..." else #pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) - useradd -m $username >> LOG || die + useradd -m $username &>> $LOG || die fi # First we make our directories @@ -112,35 +112,35 @@ tput setaf 8 printf '%s\n' " - Making app-dir (/bin/luxcena-neo)..." tput sgr0 userDir=$(eval echo "~$username") -mkdir -p "$userDir/install" >> LOG || die -chown $username:$username "$userDir/install" >> LOG || die -mkdir -p "$userDir/install/src" >> LOG || die -chown $username:$username "$userDir/install/src" >> LOG || die -mkdir -p "$userDir/install/userdata" >> LOG || die -chown $username:$username "$userDir/install/userdata" >> LOG || die +mkdir -p "$userDir/install" &>> $LOG || die +chown $username:$username "$userDir/install" &>> $LOG || die +mkdir -p "$userDir/install/src" &>> $LOG || die +chown $username:$username "$userDir/install/src" &>> $LOG || die +mkdir -p "$userDir/install/userdata" &>> $LOG || die +chown $username:$username "$userDir/install/userdata" &>> $LOG || die # Third we copy the source into the correct swap-folder tput setaf 8 printf '%s\n' " - Copying sourceCode to app-dir..." tput sgr0 -cp -r . "$userDir/install/src" >> LOG || die -chown -R $username:$username "$userDir/install/src" >> LOG || die +cp -r . "$userDir/install/src" &>> $LOG || die +chown -R $username:$username "$userDir/install/src" &>> $LOG || die # fourth we run npm i tput setaf 8 printf '%s\n' " - Running npm i..." tput sgr0 tput sc -export NODE_ENV=production >> LOG || die -runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production' >> LOG || die # This is probably a bit overkill to have --only=... but better safe than sorry? +export NODE_ENV=production &>> $LOG || die +runuser -l $username -c 'npm --prefix ~/install/src install ~/install/src --only=production' &>> $LOG || die # This is probably a bit overkill to have --only=... but better safe than sorry? tput rc; tput ed # Fifth we add the service files tput setaf 8 printf '%s\n' " - Adding service-file to systemd..." tput sgr0 -cp bin/luxcena-neo.service /etc/systemd/system/luxcena-neo.service >> LOG || die -systemctl daemon-reload >> LOG || die +cp bin/luxcena-neo.service /etc/systemd/system/luxcena-neo.service &>> $LOG || die +systemctl daemon-reload &>> $LOG || die # Installation is done! printf '\n\e[5m%s\e[0m\n' "🎉Luxcena-Neo is now installed🎉" -- cgit v1.2.3 From abb69ee9cd4139c498ef794480e21446ce8b60bf Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 21:04:36 +0200 Subject: :construction: Overwrite old logfile --- bin/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index e9c79cd..74b2763 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -6,8 +6,7 @@ tput sgr0 printf '\e[93m%s\e[0m\n\n' "---------------------" LOG="/tmp/luxcena-neo.install.log" -touch $LOG -echo "Starting Luxcena-neo installer..." &>> $LOG +echo "Starting Luxcena-neo installer..." > $LOG if [ "$EUID" -ne 0 ]; then echo "You need to run this script as root." -- cgit v1.2.3 From 7ef7e9efc4d58cc1ed9a91b96bfc63a78bd0473d Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Thu, 18 Oct 2018 21:06:20 +0200 Subject: :construction: Make all output appear in logfile --- bin/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh index 74b2763..2ccb7e0 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -50,8 +50,8 @@ function dlgYN() { dlgYN ". Update your system" res if [ $res -eq 1 ]; then tput sc - apt-get -y -qq update &>> $LOG || die - apt-get -y -qq upgrade &>> $LOG || die + apt-get -y update &>> $LOG || die + apt-get -y upgrade &>> $LOG || die tput rc; tput ed fi @@ -59,7 +59,7 @@ fi dlgYN ". Install required packages" res if [ $res -eq 1 ]; then tput sc - apt-get -y -qq install nodejs scons python-dev swig &>> $LOG || die + apt-get -y install nodejs scons python-dev swig &>> $LOG || die if [ $? -eq 0 ]; then tput rc; tput ed printf "✓" -- cgit v1.2.3