From 98538662b89adfe25d103bcebb909254872b0220 Mon Sep 17 00:00:00 2001 From: alban Date: Wed, 14 Oct 2020 17:16:25 +0200 Subject: [PATCH 1/4] [fix] The install should be more streamlined --- server/install.sh | 78 +++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/server/install.sh b/server/install.sh index 3f2e34b..4a35b8f 100755 --- a/server/install.sh +++ b/server/install.sh @@ -1,48 +1,32 @@ #!/bin/bash -sudo apt upgrade -sudo apt install python3-pip -sudo apt install redis-server -# for dedicated computer after fresh linux install. todo : ask if needed. -#sudo apt install git -#sudo apt install syncthing -#sudo apt install htop -#sudo apt install screen -#sudo apt install tmux -#sudo apt install nginx -#sudo apt install supervisor -#sudo apt install ssh -# todo one day : modify correct path in syncthing.conf -#sudo cp syncthing.conf to /etc/supervisor/conf.d/ -pip3 install scipy -pip3 install numpy -#pip install pygame==1.9.2 -#pip3 install pygame==1.9.2 -pip3 install redis -pip3 install pysimpledmx -pip3 install DMXEnttecPro -sudo apt install libasound2-dev -sudo apt install libjack-dev -pip3 install python-rtmidi -pip3 install mido -git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && sudo ./setup.py install -pip3 install tk -cd ../ -python3 configure.py -# todo : ask for computer ip and run updateUI.py -cd /tmp -sudo apt install portaudio19-dev -sudo apt install cmake -git clone https://github.com/Ableton/link.git -cd link -git submodule update --init --recursive -mkdir build -cd build -cmake .. -cmake --build . -cd /tmp/ -git clone --recursive https://github.com/gonzaloflirt/link-python.git -cd link-python -mkdir build -cd build -cmake .. -cmake --build . + +# Check if root +[[ 0 -ne $UID ]] && { echo "Must run as root. Exiting."; exit; } + +# Propose some packages +echo -e "\nThe following packages are not mandatory, add them as needed.\n" +declare -a ADD_PACK +POS_PACK=( htop nginx screen ssh ssl-cert supervisor syncthing tmux ) +POS_PACK_LEN=${#POS_PACK[@]} +for i in ${!POS_PACK[@]} ; do + pack=${POS_PACK[i]} + read -e -n 1 -p "$((i+1))/${POS_PACK_LEN} Add package ${pack} ? [Y/n]: " + REPLY=${REPLY:-Y} + [[ "Y" == ${REPLY^^} ]] && ADD_PACK+=(${pack}) +done + +# Propose the install +PACK_LIST=$( echo "cmake git libasound2-dev libjack-dev libsdl1.2-dev network-manager portaudio19-dev python3-dev python3-pip python3-rtmidi redis-server ${ADD_PACK[@]}" | sort ) +echo -e "\nYou are goind to install:\n$( for pack in ${PACK_LIST[@]}; do echo ' * '$pack; done; )\n" +read -e -n1 -p "OK? [Y/n]: " +REPLY=${REPLY:-Y} +[[ "N" == ${REPLY^^} ]] && exit + +# Run the install +apt install -y --no-install-recommends $LIST +pip3 install setuptools +pip3 install DMXEnttecPro mido numpy pysimpledmx redis scipy +git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && ./setup.py install +cd /tmp && git clone https://github.com/Ableton/link.git && cd link && git submodule update --init --recursive && mkdir build && cd build && cmake .. && cmake --build . +cd /tmp/ && git clone --recursive https://github.com/gonzaloflirt/link-python.git && cd link-python && mkdir build && cd build && cmake .. && cmake --build . +cd /opt/ && git clone https://git.interhacker.space/teamlaser/LJ -- 2.20.1 From a9268b0d73ba3b7e52365bd7faf17d6a389475b9 Mon Sep 17 00:00:00 2001 From: alban Date: Wed, 14 Oct 2020 18:12:35 +0200 Subject: [PATCH 2/4] [fix] install.sh typo was breaking the install --- server/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/install.sh b/server/install.sh index 4a35b8f..302c504 100755 --- a/server/install.sh +++ b/server/install.sh @@ -23,7 +23,7 @@ REPLY=${REPLY:-Y} [[ "N" == ${REPLY^^} ]] && exit # Run the install -apt install -y --no-install-recommends $LIST +apt install -y --no-install-recommends $PACK_LIST pip3 install setuptools pip3 install DMXEnttecPro mido numpy pysimpledmx redis scipy git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && ./setup.py install -- 2.20.1 From 506616cb1b961ad0c91fea84911de678e011fb97 Mon Sep 17 00:00:00 2001 From: alban Date: Fri, 16 Oct 2020 08:43:23 +0200 Subject: [PATCH 3/4] [fix] The install script should ask for a user --- server/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/install.sh b/server/install.sh index 302c504..2b3f3f9 100755 --- a/server/install.sh +++ b/server/install.sh @@ -3,6 +3,12 @@ # Check if root [[ 0 -ne $UID ]] && { echo "Must run as root. Exiting."; exit; } +# Require a user for exploitation +DEFAULT=$(getent group 1000|cut -d: -f1) +read -e -i "$DEFAULT" -p "Please provide the system user who will own the project: " USER + +getent group "$USER" &>/dev/null || { echo "Sorry, but '$USER' does not exist on this system. Exiting."; exit 2; } + # Propose some packages echo -e "\nThe following packages are not mandatory, add them as needed.\n" declare -a ADD_PACK @@ -30,3 +36,4 @@ git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc & cd /tmp && git clone https://github.com/Ableton/link.git && cd link && git submodule update --init --recursive && mkdir build && cd build && cmake .. && cmake --build . cd /tmp/ && git clone --recursive https://github.com/gonzaloflirt/link-python.git && cd link-python && mkdir build && cd build && cmake .. && cmake --build . cd /opt/ && git clone https://git.interhacker.space/teamlaser/LJ +chown -R $USER /opt/LJ -- 2.20.1 From 88998abde7094e57be589290ca3296509e95aad2 Mon Sep 17 00:00:00 2001 From: alban Date: Fri, 16 Oct 2020 08:47:37 +0200 Subject: [PATCH 4/4] [fix] The install script should use the right db to check if a user exists --- server/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/install.sh b/server/install.sh index 2b3f3f9..45ed53e 100755 --- a/server/install.sh +++ b/server/install.sh @@ -4,10 +4,10 @@ [[ 0 -ne $UID ]] && { echo "Must run as root. Exiting."; exit; } # Require a user for exploitation -DEFAULT=$(getent group 1000|cut -d: -f1) +DEFAULT=$(getent passwd 1000|cut -d: -f1) read -e -i "$DEFAULT" -p "Please provide the system user who will own the project: " USER -getent group "$USER" &>/dev/null || { echo "Sorry, but '$USER' does not exist on this system. Exiting."; exit 2; } +getent passwd "$USER" &>/dev/null || { echo "Sorry, but '$USER' does not exist on this system. Exiting."; exit 2; } # Propose some packages echo -e "\nThe following packages are not mandatory, add them as needed.\n" -- 2.20.1