-
Notifications
You must be signed in to change notification settings - Fork 14
/
install
101 lines (99 loc) · 3.13 KB
/
install
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
#load functions
source "$HOME/pi-ware/func/api" || echo "failed to source $HOME/pi-ware/func/api"
#Main
echo "Installing pi-ware..."
#Install python packages
sudo pip3 install -r packages.txt || echo "failed to install required packages"
mkdir -p "$PW_LOGS"
#Make required directory for updater
mkdir -p "$PW_DATA/inst"
cd "$HOME/pi-ware"
echo $(git rev-parse main) > "$PW_DATA/version"
echo "Creating a desktop entry for Pi-Ware..."
mkdir -p "$PW_APPS"
mkdir -p "$HOME/.config/autostart/pi-ware/"
#Define logo
if [ "$month" -eq "12" ]; then
logo="$HOME/pi-ware/icons/logo-full-christmas.png"
comment="Raspberry Pi app store (Happy holidays!)"
else
logo="$HOME/pi-ware/icons/logo.png"
comment="Raspberry Pi app store"
fi
#Theme (default)
touch $HOME/.local/share/pi-ware/theme
echo "arc" > $HOME/.local/share/pi-ware/theme
#Make app checking thingy
echo "{}" > $HOME/.local/share/pi-ware/installedapps.json
#Make firstrun desktop if program has not been used before.
if [[ ! -f "$PW_DATA/firstrun" ]]; then
echo "[Desktop Entry]
Name=Pi-Ware
Comment="$comment"
Exec="bash $HOME/pi-ware/func/firstuse/setup"
Icon=$logo
Categories=Utility;
Type=Application
Terminal=false" > "$PW_APPS/pi-ware.desktop"
else
echo "[Desktop Entry]
Name=Pi-Ware
Comment="$comment"
Exec="python3 $HOME/pi-ware/store/main.py"
Icon=$logo
Categories=Utility;
Type=Application
Terminal=false" > "$HOME/.local/share/applications/pi-ware.desktop"
fi
#Copy to desktop
cp -r "$HOME/.local/share/applications/pi-ware.desktop" "$HOME/Desktop/pi-ware.desktop"
#Create settings button
echo "Creating a settings desktop entry for Pi-Ware..."
echo "[Desktop Entry]
Name=Pi-Ware Settings
Comment=Change some of pi-ware's settings
Exec=python3 "$HOME/pi-ware/func/settings/settings.py"
Icon=$HOME/pi-ware/icons/logo.png
Categories=Utility;
Type=Application
Terminal=false" > "$HOME/.local/share/applications/pi-ware-settings.desktop"
echo "Creating an auto updater for Pi-Ware..."
mkdir -p "$HOME/.config/autostart/"
echo "[Desktop Entry]
Name=Pi-Ware-Auto-Updater
Comment=Auto updater for pi-ware
Exec=bash "$HOME/pi-ware/func/update/auto-update"
Icon=$HOME/pi-ware/icons/logo.png
Categories=Utility;
Type=Application
Terminal=false" > "$HOME/.config/autostart/pi-ware/update-pi-ware.desktop"
#Create pi-ware utility
cd $HOME
sudo mkdir -p "/usr/local/bin"
sudo cp -r "$HOME/pi-ware/func/term/pi-ware-term" "/usr/local/bin/pi-ware"
sudo chmod +x /usr/local/bin/pi-ware
echo "Added pi-ware-commands to Terminal!"
echo "Please restart terminal to apply changes."
#Set aarch
echo "Your aarch type is: $(uname -m)"
if [ "$(uname -m)" == "armv7l" ]; then
echo "armv7l" > "$PW_DATA/aarch"
elif [ "$(uname -m)" == "aarch64" ]; then
echo "aarch64" > "$PW_DATA/aarch"
else
warning 2 "Unable to detect arch type! Continuing install..."
fi
#Set package manager
if [ -f /usr/bin/apt ];then
echo "Package manager is: apt"
echo "sudo apt-get -y" > "$PW_DATA/inst-pref"
elif [ -f /usr/bin/pacman ];then
echo "Package manager is: pacman"
echo "pacman -S" > "$PW_DATA/inst-pref"
else
error "Failed to find any package manager." "exit"
fi
#Finished
echo "Done!"
echo "You can find Pi-Ware in Menu > Accessories > Pi-Ware."