-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (41 loc) · 1.25 KB
/
install.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
echo "Installing drivers..."
sudo apt update
sudo apt install ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
echo "Installing Pyhton 3 and virtualenv..."
sudo apt install python3-venv
echo "Creating virtual environment..."
python3 -m venv .venv-labelmaker
source .venv-labelmaker/bin/activate
pip install -r req.txt
echo "Creating udev rules..."
echo 'ACTION=="add",'\
'SUBSYSTEMS=="usb",'\
'ATTRS{idVendor}=="0922",'\
'ATTRS{idProduct}=="1002",'\
'MODE="0666"' \
| sudo tee /etc/udev/rules.d/91-labelle-0922-1002.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --attr-match=idVendor="0922"
echo "Creating and starting systemd service..."
mkdir -p ~/.config/systemd/user
# Define the new ExecStart path
NEW_EXECSTART=$(find "$PWD" -name start.sh)
# Write the service file with the new ExecStart line
cat > ~/.config/systemd/user/labelmaker.service << EOF
[Unit]
Description=labelmaker
After=network.target
[Service]
Type=simple
ExecStart=$NEW_EXECSTART
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable labelmaker.service
systemctl --user start labelmaker.service
echo "Finished installation. Rebooting in 5s..."
duration=$(( SECONDS - 5 ))
sudo reboot