From 7fe978e8a94d572bdd9d9db4583f562df6114eaa Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 3 Feb 2021 19:51:20 +0100 Subject: [PATCH 1/6] added documentation and some minor changes --- install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 75216e9..6353e7a 100644 --- a/install.sh +++ b/install.sh @@ -1,16 +1,19 @@ #!/bin/bash GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx" GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters +TARGET_DIR="/opt" USERNAME=$(logname) +# v Se om script blir kjoert som root + if [[ $EUID -ne 0 ]]; then echo "This script must be run as root." exit 1 fi -apt update && apt install -y git wine setserial tlp -systemctl enable tlp --now -cd /opt/ +apt update && apt install -y git wine setserial tlp #install dependencies +systemctl enable tlp --now #enable and start nessecary systemd service file +cd $TARGET_DIR/ #change current working directory git clone $GIT_REPO cd $GIT_NAME @@ -21,7 +24,7 @@ Description=Wine Serial Fix After=network.target [Service] Type=simple -ExecStart=bash /opt/$GIT_NAME/wine_serial_fix.sh $USERNAME +ExecStart=bash $TARGET_DIR/$GIT_NAME/wine_serial_fix.sh $USERNAME TimeoutStartSec=0 [Install] WantedBy=graphical.target" > "/etc/systemd/system/wine-serial-fix.service" @@ -29,7 +32,7 @@ systemctl daemon-reload systemctl enable wine-serial-fix.service --now -sudo -H -u $USERNAME bash -c "cd /opt/$GIT_NAME && wine DLOADX*.exe" +sudo -H -u $USERNAME bash -c "cd $TARGET_DIR/$GIT_NAME && wine DLOADX*.exe" echo -e "\e[1;32mFerdig. Logg ut og inn av økten eller start datamaskinen på nytt.\e[0m" \ No newline at end of file -- 2.20.1 From 69166faf301fcab1db9ed88e12c0bdd02557831f Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 3 Feb 2021 20:01:41 +0100 Subject: [PATCH 2/6] added more documentation --- install.sh | 24 +++++++++++------------- wine_serial_fix.sh | 6 +++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index 6353e7a..b6f1285 100644 --- a/install.sh +++ b/install.sh @@ -1,24 +1,22 @@ #!/bin/bash GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx" GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters -TARGET_DIR="/opt" +TARGET_DIR="/opt" #directory to install to USERNAME=$(logname) -# v Se om script blir kjoert som root - -if [[ $EUID -ne 0 ]]; then +if [[ $EUID -ne 0 ]]; then #make shure that script is being run as root echo "This script must be run as root." exit 1 fi apt update && apt install -y git wine setserial tlp #install dependencies systemctl enable tlp --now #enable and start nessecary systemd service file -cd $TARGET_DIR/ #change current working directory -git clone $GIT_REPO -cd $GIT_NAME +cd $TARGET_DIR/ #change current working directory to install directory +git clone $GIT_REPO #clone git again +cd $GIT_NAME #enter directory of cloned git -adduser $USERNAME dialout +adduser $USERNAME dialout # ???? echo "[Unit] Description=Wine Serial Fix After=network.target @@ -27,12 +25,12 @@ Type=simple ExecStart=bash $TARGET_DIR/$GIT_NAME/wine_serial_fix.sh $USERNAME TimeoutStartSec=0 [Install] -WantedBy=graphical.target" > "/etc/systemd/system/wine-serial-fix.service" -systemctl daemon-reload -systemctl enable wine-serial-fix.service --now +WantedBy=graphical.target" > "/etc/systemd/system/wine-serial-fix.service" #creates systemd service file +systemctl daemon-reload #make systemd detect the new service file +systemctl enable wine-serial-fix.service --now #enables and starts the systemd service file -sudo -H -u $USERNAME bash -c "cd $TARGET_DIR/$GIT_NAME && wine DLOADX*.exe" +sudo -H -u $USERNAME bash -c "cd $TARGET_DIR/$GIT_NAME && wine DLOADX*.exe" # ??????? -echo -e "\e[1;32mFerdig. Logg ut og inn av økten eller start datamaskinen på nytt.\e[0m" \ No newline at end of file +echo -e "\e[1;32mFerdig. Logg ut og inn av økten eller start datamaskinen på nytt.\e[0m" #done \ No newline at end of file diff --git a/wine_serial_fix.sh b/wine_serial_fix.sh index b109af4..bdacb86 100755 --- a/wine_serial_fix.sh +++ b/wine_serial_fix.sh @@ -19,7 +19,7 @@ function doTheThang # TTY is empty if no serial device is detected TTY=$(setserial -g /dev/ttyUSB[0-9] | awk -F"," '{print $1}') - if [ ! -z "$TTY" ]; then + if [ ! -z "$TTY" ]; then #configure wine to use serial device echo -e "\e[1;32mUsing serial device: $TTY\e[0m" ln -sfn $TTY /home/$USERNAME/.wine/dosdevices/com1 && chown $USERNAME /home/$USERNAME/.wine/dosdevices/com1 && @@ -32,11 +32,11 @@ doTheThang LSUSB=$(lsusb) while : -do +do #look for usb if [ "$LSUSB" != "$(lsusb)" ]; then LSUSB=$(lsusb) echo "=======USB Change detected=======" - doTheThang + doTheThang #usb found, run function fi sleep 1 done \ No newline at end of file -- 2.20.1 From be7862b457f087d804b9fd66f50af61f845b3b65 Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 3 Feb 2021 20:09:24 +0100 Subject: [PATCH 3/6] you can now choose install directrory --- install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/install.sh b/install.sh index b6f1285..ddd2f89 100644 --- a/install.sh +++ b/install.sh @@ -4,6 +4,15 @@ GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird character TARGET_DIR="/opt" #directory to install to USERNAME=$(logname) +echo "What directory do you want to install to?" +echo "Specify directory below and files wil be copied in to a subdirectory of that directory called /$GIT_NAME" +echo "Default is /opt" +read TARGET_DIR + +if [ $TARGET_DIR == "" ]; then + TARGET_DIR="/opt" +fi + if [[ $EUID -ne 0 ]]; then #make shure that script is being run as root echo "This script must be run as root." exit 1 -- 2.20.1 From ee2e8acdcec6c97e141b54859ab3bd922156291e Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 3 Feb 2021 20:11:29 +0100 Subject: [PATCH 4/6] added more documentation --- install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ddd2f89..14b7268 100644 --- a/install.sh +++ b/install.sh @@ -6,10 +6,12 @@ USERNAME=$(logname) echo "What directory do you want to install to?" echo "Specify directory below and files wil be copied in to a subdirectory of that directory called /$GIT_NAME" -echo "Default is /opt" +echo "Default if nothing is entered is /opt" read TARGET_DIR +# ^ +# L_ get user input -if [ $TARGET_DIR == "" ]; then +if [ $TARGET_DIR == "" ]; then #set directory to /opt if the user wrote nothing TARGET_DIR="/opt" fi -- 2.20.1 From 3025579b98f79f06710db122be7c7c7aca6d5251 Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 3 Feb 2021 20:12:32 +0100 Subject: [PATCH 5/6] added more documentation --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 14b7268..1eb71ec 100644 --- a/install.sh +++ b/install.sh @@ -1,15 +1,15 @@ #!/bin/bash GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx" GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters -TARGET_DIR="/opt" #directory to install to +#TARGET_DIR="/opt" #directory to install to USERNAME=$(logname) echo "What directory do you want to install to?" echo "Specify directory below and files wil be copied in to a subdirectory of that directory called /$GIT_NAME" echo "Default if nothing is entered is /opt" + +#get user input read TARGET_DIR -# ^ -# L_ get user input if [ $TARGET_DIR == "" ]; then #set directory to /opt if the user wrote nothing TARGET_DIR="/opt" -- 2.20.1 From 3d9022dcc5e9460669bbd1708686252b65fb2c01 Mon Sep 17 00:00:00 2001 From: filip Date: Thu, 4 Feb 2021 13:55:07 +0100 Subject: [PATCH 6/6] changes --- install.sh | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 1eb71ec..b6f1285 100644 --- a/install.sh +++ b/install.sh @@ -1,20 +1,9 @@ #!/bin/bash GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx" GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters -#TARGET_DIR="/opt" #directory to install to +TARGET_DIR="/opt" #directory to install to USERNAME=$(logname) -echo "What directory do you want to install to?" -echo "Specify directory below and files wil be copied in to a subdirectory of that directory called /$GIT_NAME" -echo "Default if nothing is entered is /opt" - -#get user input -read TARGET_DIR - -if [ $TARGET_DIR == "" ]; then #set directory to /opt if the user wrote nothing - TARGET_DIR="/opt" -fi - if [[ $EUID -ne 0 ]]; then #make shure that script is being run as root echo "This script must be run as root." exit 1 -- 2.20.1