forked from Pi-Apps-Recreates/pi-apps-x86
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·142 lines (121 loc) · 4.56 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
function error {
echo -e "\e[91m$1\e[39m"
exit 1
}
cd $HOME
if [[ "$(id -u)" == 0 ]]; then
error "Nitely x86 is not designed to be installed as root! Please try again as a regular user."
fi
command -v apt >/dev/null || error "apt: command not found. Most likely this system is not running Debian."
#Ensure running x86 processor
if uname -m | grep -q 'arm' ;then
error "Nitely x86 is not not supported on arm processors. Get this instead https://github.com/C-EO/Nitely."
fi
sudo apt update || error "The command 'sudo apt update' failed. Before Nitely x86 will work, you must fix your apt package-management system."
#install yad automatically
if ! command -v yad >/dev/null;then
sudo apt install -y yad || error "Failed to install yad."
fi
#remove annoying YAD icon browser launcher
sudo rm -f /usr/share/applications/yad-icon-browser.desktop
#install git
if ! command -v git >/dev/null;then
sudo apt install -y git || error "Failed to install git."
fi
#install curl
if ! command -v curl >/dev/null;then
sudo apt install -y curl || error "Failed to install curl."
fi
#download pi-apps if folder missing
DIRECTORY="$(readlink -f "$(dirname "$0")")"
if [ -z "$DIRECTORY" ] || [ "$DIRECTORY" == "$HOME" ] || [ "$DIRECTORY" == bash ];then
DIRECTORY="$HOME/nitely-x86"
#if directory does not exist, download it
if [ ! -d "$DIRECTORY" ];then
echo "Downloading Nitely x86..."
output="$(git clone --depth 1 https://github.com/C-EO/nitely-x86 "$DIRECTORY" 2>&1)"
if [ ! -d "$DIRECTORY" ];then
error "Nitely-x86 download failed!\ngit clone output was: $output"
fi
fi
fi #Past this point, DIRECTORY variable populated with valid pi-apps directory
#if chromeOS, install lxterminal
if command -v garcon-terminal-handler >/dev/null ;then
echo "In order to install apps on chromeOS, a working terminal emulator is required.
Installing lxterminal in 10 seconds... (press Ctrl+C to cancel)"
sleep 10
sudo apt install -yf lxterminal || error "Failed to install lxterminal on chromeOS!"
fi
#menu button
if [ ! -f ~/.local/share/applications/nitely-86.desktop ];then
echo "Creating menu button..."
fi
mkdir -p ~/.local/share/applications
echo "[Desktop Entry]
Name=Nitely X86
Comment=App store for Linux Open Source projects
Exec=${DIRECTORY}/gui
Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
Categories=Utility;
StartupNotify=true" > ~/.local/share/applications/nitely-x86.desktop
if [ ! -f ~/.local/share/applications/nitely-x86-settings.desktop ];then
echo "Creating Settings menu button..."
fi
echo "[Desktop Entry]
Name=Nitely x86 Settings
Comment=Configure Nitely x86 or create an app
Exec=${DIRECTORY}/settings
Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
Categories=Settings;
StartupNotify=true" > ~/.local/share/applications/nitely-x86-settings.desktop
if [ ! -f ~/.config/autostart/nitely-x86-updater.desktop ];then
echo "Creating autostarted updater..."
fi
mkdir -p ~/.config/autostart
echo "[Desktop Entry]
Name=Nitely x86 Updater
Exec=${DIRECTORY}/updater onboot
Icon=${DIRECTORY}/icons/logo.png
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
Hidden=false
NoDisplay=false" > ~/.config/autostart/nitely-x86-updater.desktop
mkdir -p "${DIRECTORY}/data" && cd "${DIRECTORY}/data" || error "Failed to make and enter ${DIRECTORY}/data directory!"
mkdir -p installed-packages preload settings status update-status categories
cd $HOME
#pi-apps terminal command
if [ ! -f /usr/local/bin/nitely-x86 ] || ! cat /usr/local/bin/nitely-x86 | grep -q "${DIRECTORY}/gui";then
echo "#!/bin/bash
${DIRECTORY}/gui"' "$@"' | sudo tee /usr/local/bin/nitely-x86 >/dev/null
sudo chmod +x /usr/local/bin/nitely-x86
echo "You can now launch nitely x86 from a terminal, just by running 'nitely-x86'"
fi
if [ "$(ls "$DIRECTORY/data/settings" 2>/dev/null | wc -l)" -le 2 ];then
echo "Generating default settings..."
fi
if [ ! -f "$DIRECTORY/data/preload/LIST-" ];then
echo "Preloading app list..."
fi
"${DIRECTORY}/preload" &>/dev/null
sudo chmod +x ~/nitely-x86/uninstall
sudo chmod +x ~/nitely-x86/gui
sudo chmod +x ~/nitely-x86/createapp
sudo chmod +x ~/nitely-x86/manage
sudo chmod +x ~/nitely-x86/pkg-install
sudo chmod +x ~/nitely-x86/preload
sudo chmod +x ~/nitely-x86/purge-installed
sudo chmod +x ~/nitely-x86/settings
sudo chmod +x ~/nitely-x86/updater
sudo chmod +x ~/nitely-x86/etc/terminal-run
sudo chmod +x ~/nitely-x86/etc/bitlylink
sudo chmod +x ~/nitely-x86/etc/categoryedit
sudo chmod +x ~/nitely-x86/etc/logviewer
sudo chmod +x ~/nitely-x86/etc/preload-daemon
sudo chmod +x ~/nitely-x86/etc/viewlog
echo "Installation complete."