forked from NextDom/NextDom_Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNextDom_Installer_v1.8.sh
136 lines (115 loc) · 3.54 KB
/
NextDom_Installer_v1.8.sh
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
#!/bin/bash
#2020-01-08 : v1.8 : ajout compatibilité RPI
#2020-01-05 : v1.7 : Correction Typo
#2019-12-30 : v1.6 : mise en place de fonction
#2019-11-26 : v1.5 : correction de l'ordre d'installation des dépendances.
#2019-11-25 : v1.3 : ajout dépôt pour install git + clé
if [[ $1 == "" ]]; then
echo
echo " Usage: "$0" [-git] installation de NextDom via GitClone"
echo " Usage: "$0" [-apt] installation de NextDom via un paquet Deb"
echo " [-apt] [ ] installation depuis le dépôt officiel"
echo " [-apt] [-d] installation du paquet depuis le dépôt dev"
echo " [-apt] [-n] installation du paquet depuis le dépôt nightly"
echo
fi
function cleanfld {
rm -Rf /var/log/nextdom* 2>/dev/null
echo "Dossier /var/log/nextdom* supprimé"
rm -Rf /var/lib/nextdom* 2>/dev/null
echo "Dossier /var/lib/nextdom* supprimé"
rm -Rf /var/www/html* 2>/dev/null
echo "Dossier /var/www/html* supprimé"
rm -Rf /usr/share/nextdom* 2>/dev/null
echo "Dossier /usr/share/nextdom* supprimé"
rm -Rf /tmp/nextdom/* 2>/dev/null
echo "Suppression du dossier tmp nextdom"
}
function cleannxt {
apt purge -y nextdom
apt autoremove -y
}
function basenxt {
echo "Création dossier HTML"
mkdir /var/www/html 2>/dev/null
if [[ $1 == "-git" ]]; then
echo ""
echo "..:: Installation via GIT ::.."
echo ""
elif [[ $1 == "-gitbr" ]]; then
echo ""
echo "..:: Changement de branche via GIT ::.."
echo ""
else
echo ""
echo "..:: Installation via APT ::.."
echo ""
fi
apt update
apt install -y software-properties-common gnupg wget ca-certificates
sed '/non-free/!s/main/main non-free/' /etc/apt/sources.list
wget -qO - http://debian.nextdom.org/debian/nextdom.gpg.key | apt-key add -
echo "deb http://debian.nextdom.org/debian nextdom main" >/etc/apt/sources.list.d/nextdom.list
apt update
apt -y install nextdom-common
}
if [[ $1 == "-git" ]]; then
cleanfld
cleannxt
basenxt $1
cd /var/www/html/
git clone https://github.com/NextDom/nextdom-core .
git config core.fileMode false
./install/postinst
fi
if [[ $1 == "-apt" ]]; then
cleanfld
cleannxt
basenxt $1
if [ $2 == "" ]; then
echo " installation de NextDom via APT sur le dépôts officiel"
echo "deb http://debian.nextdom.org/debian nextdom main" >/etc/apt/sources.list.d/nextdom.list
apt update
apt install -y nextdom
fi
if [ $2 == "-d" ]; then
echo " installation de NextDom via APT sur le dépôts dev"
echo "deb http://debian-dev.nextdom.org/debian nextdom main" >/etc/apt/sources.list.d/nextdom.list
apt update
apt install -y nextdom
fi
if [ $2 == "-n" ]; then
echo " installation de NextDom via APT sur le dépôts dev"
echo "deb http://debian-nightly.nextdom.org/debian nextdom main" >/etc/apt/sources.list.d/nextdom.list
apt update
apt install -y nextdom
fi
fi
if [[ $1 == "-gitbr" ]]; then
cleanfld
cleannxt
basenxt $1
cd /var/www/html
git clone https://github.com/NextDom/nextdom-core .
git config core.fileMode false
echo "passage à la branche " $2
git checkout $2
git reset --hard origin/$2
./install/postinst
fi
if [[ $1 == "-?" ]] || [[ $1 == "-help" ]]; then
echo ""
echo "NextDom Installer tool v1.6"
echo ""
echo ""
echo " -apt : Installation via apt, dépôt officiel"
echo " -apt -n : version nightly"
echo " -apt -d : version dépôt develop"
echo ""
echo " -git : Installation via git"
echo ""
echo " -gitbr NOM_DE_LA_BRANCHE : Changement de branche git"
echo ""
echo " -? ou -help : afficher l'aide et quitter"
fi
exit