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