forked from ivan-hc/AM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
executable file
·113 lines (91 loc) · 4.31 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
#!/bin/sh
_away_error() {
${1} >/dev/null 2>&1
}
_away_all() {
${1} >/dev/null
}
# DETERMINE SYSTEM ARCHITECTURE AND CURRENT USER
arch=$(uname -m)
currentuser=$(who | awk '{print $1}')
_check_dependency() {
program="$1"
_away_all command -v "$program" && return 0 || echo "For Installation to work, install \"$program\" first!" && exit 1
}
_check_dependency 'wget'
_check_dependency 'curl'
# CREATING THE MAIN DIRECTORY FOR "AM"
mkdir -p /opt/am/.cache /opt/am/modules || exit 1
cd /opt/am || exit 1
# CREATE THE SCRIPT NEEDED TO UNINSTALL "AM"
printf '#!/bin/sh\n\nset -e\n' > /opt/am/remove
printf '\n%s\n' 'if [ "$(id -u)" -ne 0 ]; then echo "Permission denied"; exit 1; fi' >> /opt/am/remove
printf '%s\n' 'rm -f /usr/local/bin/am /etc/bash_completion.d/am-completion.sh' >> /opt/am/remove
printf '%s\n' 'rm -R -f /opt/am' >> /opt/am/remove
chmod a+x /opt/am/remove || exit 1
# DOWNLOAD THE MAIN SCRIPT
wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/APP-MANAGER
chmod a+x /opt/am/APP-MANAGER || exit 1
# LINK THE MAIN SCRIPT TO A KNOWN PATH
ln -s /opt/am/APP-MANAGER /usr/local/bin/am || echo "WARNING: Something went wrong!"
# DOWNLOAD THE LIST OF THE AVAILABLE PROGRAMS
wget -q "https://raw.githubusercontent.com/ivan-hc/AM/main/programs/$arch-apps" || exit 1
# DOWNLOAD MODULES
MODULES=$(curl -Ls https://api.github.com/repos/ivan-hc/AM/contents/modules | sed 's/[()",{}]/ /g; s/ /\n/g' | grep -o 'https.*raw.*modules.*am$' | grep -v "sync\|update")
for module in $MODULES; do
for v in $module; do
cd /opt/am/modules || exit
mkdir -p tmp
cd tmp || exit
wget -q "$v"
cd ..
mv tmp/*.am ./
chmod a+x ./*.am
rmdir tmp
done
done
# ENABLE NON-ROOT PERMISSIONS TO THE MAIN DIRECTORY FOR THE CURRENT USER
chown -R $currentuser /opt/am 2> /dev/null
# ADD THE BASH COMPLETION SCRIPT
echo '#!/usr/bin/env bash
complete -W "$(cat /opt/am/list 2>/dev/null)" am' >> /opt/am/am-completion.sh
chmod a+x /opt/am/am-completion.sh
if test -f /etc/bash_completion.d; then
mv /opt/am/am-completion.sh /etc/bash_completion.d/
else
mkdir -p /etc/bash_completion.d
sudo mv /opt/am/am-completion.sh /etc/bash_completion.d/
fi
# SHOW THE MESSAGE
echo '
_____ _____
/\ \ /\ \ A A
/::\ \ /::\____\ P M
/::::\ \ /::::| | P
/::::::\ \ /:::::| | M &
/:::/\:::\ \ /::::::| | A
/:::/__\:::\ \ /:::/|::| | N
/::::\ \:::\ \ /:::/ |::| |
/::::::\ \:::\ \ /:::/ |::|___|______
/:::/\:::\ \:::\ \ /:::/ |::::::::\ \
/:::/ \:::\ \:::\____\/:::/ |:::::::::\____\
\::/ \:::\ /:::/ /\::/ / ~~~~~/:::/ /
\/____/ \:::\/:::/ / \/____/ /:::/ /
\::::::/ / /:::/ /
\::::/ / /:::/ /
/:::/ / /:::/ /╔═╗╔╗╔┌─┐┌─┐┌─┐┬─┐
/:::/ / /:::/ / ╠═╣║║║├─┤│ ┬├┤ ├┬┘
/:::/ / /:::/ / ╩ ╩╝╚╝┴ ┴└─┘└─┘┴└─
/:::/ /╔═╗╔═╗┬ ┬┌─┐┌─┐┌┬┐┬┌─┐┌┐┌
\::/ / ╠═╝╠═╝│ ││ ├─┤ │ ││ ││││
\/____/ ╩ ╩ ┴─┘┴└─┘┴ ┴ ┴ ┴└─┘┘└┘ by Ivan Alex HC
>> 𝘋𝘢𝘵𝘢𝘣𝘢𝘴𝘦 & 𝘴𝘰𝘭𝘶𝘵𝘪𝘰𝘯𝘴 𝘧𝘰𝘳 𝘢𝘭𝘭 𝘈𝘱𝘱𝘐𝘮𝘢𝘨𝘦𝘴 𝘢𝘯𝘥 𝘱𝘰𝘳𝘵𝘢𝘣𝘭𝘦 𝘢𝘱𝘱𝘴 𝘧𝘰𝘳 𝘎𝘕𝘜/𝘓𝘪𝘯𝘶𝘹 <<
##########################################################################
__________________________________________________________________________
SITE: https://portable-linux-apps.github.io
REPOSITORY: https://github.com/ivan-hc/AM
__________________________________________________________________________
##########################################################################
Run "am -h" to see the list of the options
##########################################################################
'