kvs-linuxmint-dloadx/install.sh

47 lines
1.6 KiB
Bash
Raw Normal View History

2021-01-31 11:41:38 +00:00
#!/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
2021-02-03 19:01:41 +00:00
TARGET_DIR="/opt" #directory to install to
2021-01-31 11:41:38 +00:00
USERNAME=$(logname)
2021-02-03 19:09:24 +00:00
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"
2021-02-03 19:11:29 +00:00
echo "Default if nothing is entered is /opt"
2021-02-03 19:09:24 +00:00
read TARGET_DIR
2021-02-03 19:11:29 +00:00
# ^
# L_ get user input
2021-02-03 19:09:24 +00:00
2021-02-03 19:11:29 +00:00
if [ $TARGET_DIR == "" ]; then #set directory to /opt if the user wrote nothing
2021-02-03 19:09:24 +00:00
TARGET_DIR="/opt"
fi
2021-02-03 19:01:41 +00:00
if [[ $EUID -ne 0 ]]; then #make shure that script is being run as root
2021-01-31 11:41:38 +00:00
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
2021-02-03 19:01:41 +00:00
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
2021-01-31 11:41:38 +00:00
2021-02-03 19:01:41 +00:00
adduser $USERNAME dialout # ????
2021-01-31 11:41:38 +00:00
echo "[Unit]
Description=Wine Serial Fix
After=network.target
[Service]
Type=simple
ExecStart=bash $TARGET_DIR/$GIT_NAME/wine_serial_fix.sh $USERNAME
2021-01-31 11:41:38 +00:00
TimeoutStartSec=0
[Install]
2021-02-03 19:01:41 +00:00
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
2021-01-31 11:41:38 +00:00
2021-02-03 19:01:41 +00:00
sudo -H -u $USERNAME bash -c "cd $TARGET_DIR/$GIT_NAME && wine DLOADX*.exe" # ???????
2021-01-31 11:41:38 +00:00
2021-02-03 19:01:41 +00:00
echo -e "\e[1;32mFerdig. Logg ut og inn av økten eller start datamaskinen på nytt.\e[0m" #done