added documentation and some minor changes

This commit is contained in:
filip 2021-02-03 19:51:20 +01:00
parent be0c362501
commit 7fe978e8a9

View File

@ -1,16 +1,19 @@
#!/bin/bash #!/bin/bash
GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx" GIT_REPO="https://git.willy.club/William/kvs-linuxmint-dloadx"
GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters GIT_NAME="kvs-linuxmint-dloadx" # Must not contain spaces and/or weird characters
TARGET_DIR="/opt"
USERNAME=$(logname) USERNAME=$(logname)
# v Se om script blir kjoert som root
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root." echo "This script must be run as root."
exit 1 exit 1
fi fi
apt update && apt install -y git wine setserial tlp apt update && apt install -y git wine setserial tlp #install dependencies
systemctl enable tlp --now systemctl enable tlp --now #enable and start nessecary systemd service file
cd /opt/ cd $TARGET_DIR/ #change current working directory
git clone $GIT_REPO git clone $GIT_REPO
cd $GIT_NAME cd $GIT_NAME
@ -21,7 +24,7 @@ Description=Wine Serial Fix
After=network.target After=network.target
[Service] [Service]
Type=simple 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 TimeoutStartSec=0
[Install] [Install]
WantedBy=graphical.target" > "/etc/systemd/system/wine-serial-fix.service" WantedBy=graphical.target" > "/etc/systemd/system/wine-serial-fix.service"
@ -29,7 +32,7 @@ systemctl daemon-reload
systemctl enable wine-serial-fix.service --now 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" echo -e "\e[1;32mFerdig. Logg ut og inn av økten eller start datamaskinen på nytt.\e[0m"