-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup
54 lines (48 loc) · 1.73 KB
/
setup
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
51
52
53
54
#!/usr/bin/bash
echo -e "1. Install\n2. Uninstall"
read -p "Input: " input
if [[ $input -eq 1 ]]; then
echo "Installing..."
echo "Installing Dependencies..."
sudo apt-get install python3 python3-pip python3-tk -y
pip3 install datetime
echo "Making Directories..."
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
fi
if [ ! -d "$HOME/.local/share/icons/age_calculator_gui" ]; then
mkdir -p "$HOME/.local/share/icons/age_calculator_gui"
fi
if [ ! -d "$HOME/.local/share/applications" ]; then
mkdir -p "$HOME/.local/share/applications"
fi
echo "Copying Files..."
cp age_calc_gui.py "$HOME/.local/bin/"
cp age_calculator.svg age_calculator.png "$HOME/.local/share/icons/age_calculator_gui/"
echo "Copying .desktop file..."
desktop_file_content="[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/home/$USER/.local/bin/age_calc_gui.py
Name=Age Calculator
Icon=/home/$USER/.local/share/icons/age_calculator_gui/age_calculator.svg
Name[en_US]=Age Calculator
GenericName[en_US]=Age calculator launcher"
echo "$desktop_file_content" > "$HOME/.local/share/applications/age_calculator.desktop"
echo "Adding Permissions..."
chmod +755 "$HOME/.local/bin/age_calc_gui.py"
chmod +644 "$HOME/.local/share/applications/age_calculator.desktop"
read -p "Press Enter to finish"
elif [[ $input -eq 2 ]]; then
echo "Uninstalling..."
echo "Removing Files..."
rm "$HOME/.local/bin/age_calc_gui.py"
rm -rf "$HOME/.local/share/icons/age_calculator_gui"
rm "$HOME/.local/share/applications/age_calculator.desktop"
read -p "Press Enter to finish"
else
echo "Wrong Input"
read -p "Press Enter to exit"
fi