Skip to content

Commit 2951b58

Browse files
authored
config: arn,ldn,rezine - replace ifconfig by ip (#8)
timeout…
1 parent b577763 commit 2951b58

File tree

3 files changed

+26
-30
lines changed

3 files changed

+26
-30
lines changed

arn.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ install_free_dongle_drivers() {
121121
if [ "$nonfree_dongle" = "no" ]; then
122122
wget -O /lib/firmware/htc_7010.fw "https://github.com/labriqueinternet/hotspot_ynh/raw/master/conf/firmware_htc-7010.fw"
123123
wget -O /lib/firmware/htc_9271.fw "https://github.com/labriqueinternet/hotspot_ynh/raw/master/conf/firmware_htc-9271.fw"
124-
124+
125125
echo -e "\n${LGREEN}Les drivers libres du dongle WiFi ont été installés, veuillez débrancher puis rebrancher le dongle WiFi de votre Brique.${BLUE}"
126126
read -rsp $'Pressez n\'importe quelle touche une fois le dongle rebranché...\n' -n1 yolo
127127
echo -e "${NC}\n"
@@ -310,11 +310,8 @@ remove_dyndns_cron() {
310310

311311

312312
display_win_message() {
313-
ip6=$(ifconfig tun0 | awk '/adr inet6/{print $3}' | sed 's/\/64//' || echo 'ERROR')
314-
if [ -z "$ip6" ]; then
315-
ip6=$(ifconfig tun0 | awk '/inet6 adr/{print $3}' | sed 's/\/64//' || echo 'ERROR')
316-
fi
317-
ip4=$(ifconfig tun0 | awk '/inet adr/{print substr($2,5)}' || echo 'ERROR')
313+
ip6=$(ip -6 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
314+
ip4=$(ip -4 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
318315

319316
echo -e "\nVotre $cubename a été correctement configurée."
320317

ldn.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ configure_vpnclient() {
149149

150150
# Restrict user access to the app
151151
yunohost app addaccess vpnclient -u $username
152-
152+
153153
# Copy certificates and keys
154154
mkdir -p /etc/openvpn/keys
155155
echo '-----BEGIN CERTIFICATE-----' > /etc/openvpn/keys/user.crt
@@ -173,13 +173,13 @@ configure_vpnclient() {
173173
yunohost app setting vpnclient server_port -v "1194"
174174
yunohost app setting vpnclient server_proto -v "udp"
175175
yunohost app setting vpnclient service_enabled -v "1"
176-
176+
177177
yunohost app setting vpnclient ip6_net -v "$ip6_net"
178178
yunohost app setting vpnclient ip6_addr -v "${ip6_net}42"
179179

180180
# Add the service to YunoHost's monitored services
181181
yunohost service add ynh-vpnclient -l /var/log/openvpn-client.log
182-
182+
183183
echo "Restarting OpenVPN..."
184184
systemctl restart ynh-vpnclient \
185185
|| (echo "Logs:" && cat /var/log/openvpn-client.log && exit 1)
@@ -244,7 +244,7 @@ remove_dyndns_cron() {
244244
add_vpn_restart_cron() {
245245
echo "Adding a cronjob to ensure the VPN functioning..."
246246

247-
echo "* * * * * root /sbin/ifconfig tun0 > /dev/null 2>&1 || systemctl restart ynh-vpnclient" > /etc/cron.d/restart-vpn
247+
echo "* * * * * root /bin/ip a s tun0 > /dev/null 2>&1 || systemctl restart ynh-vpnclient" > /etc/cron.d/restart-vpn
248248
}
249249

250250
configure_DKIM() {
@@ -259,8 +259,8 @@ configure_DKIM() {
259259
}
260260

261261
display_win_message() {
262-
ip6=$(ifconfig | grep -C4 tun0 | awk '/inet6 addr/{print $3}' | sed 's/\/64//' || echo 'ERROR')
263-
ip4=$(ifconfig | grep -C4 tun0 | awk '/inet addr/{print substr($2,6)}' || echo 'ERROR')
262+
ip6=$(ip -6 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
263+
ip4=$(ip -4 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
264264

265265
cat <<EOF
266266

rezine.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ utilisée par les abeilles comme mortier et anti-infectieux pour assainir la ruc
2323
2424
* Tous les mots de passe seront : ${RED}\e[4m${dummy_pwd}${NC}\e[24m (à changer après l'execution de ce script)
2525
26-
* Ce script a besoin d'être executé en temps que root ${RED}\e[4mSUR${NC}\e[24m la brique à partir d'une image
26+
* Ce script a besoin d'être executé en temps que root ${RED}\e[4mSUR${NC}\e[24m la brique à partir d'une image
2727
labriqueinternet_04-06-2015_jessie.img installée sur la carte SD
28-
29-
* Si vous rencontrez des problèmes, référez-vous à la documentation originale :
28+
29+
* Si vous rencontrez des problèmes, référez-vous à la documentation originale :
3030
https://yunohost.org/installation_brique_fr${LGREEN}
3131
_____________________________________________________________________________________________
3232
\n\n${LBLUE}"
@@ -131,15 +131,15 @@ get_variables() {
131131
read install_pirate
132132
echo
133133
fi
134-
if [ "${install_pirate}" = "oui" ]; then
134+
if [ "${install_pirate}" = "oui" ]; then
135135
echo -e "${RED}[Optionnel] ${LGREEN}Nom du SSID de votre hotspot pour la PirateBox\n${GRAY}Defaut: ShareBox${NC}"
136136
read pirate_ssid
137137
if [ -z "${pirate_ssid}" ]; then
138138
pirate_ssid="ShareBox"
139139
fi
140140
echo
141141
echo -e "${RED}[Optionnel] ${LGREEN}Choisir un nom pour la PirateBox\n${GRAY}Defaut: PirateBox${NC}"
142-
read pirate_name
142+
read pirate_name
143143
if [ -z "${pirate_name}" ]; then
144144
pirate_name="PirateBox"
145145
fi
@@ -253,7 +253,7 @@ create_yunohost_user() {
253253
echo -e " =========================================== "
254254
echo -e " Création du premier utilisateur YunoHost..."
255255
echo -e " =========================================== ${NC}\n"
256-
256+
257257
if [ -n "$(yunohost user list | grep username)" ]; then
258258
echo -e "${LGREEN}"
259259
echo -e " ## Il y a déjà un utilisateur principal, passage à la suite... ##\n"
@@ -289,7 +289,7 @@ configure_vpnclient() {
289289

290290
# Restrict user access to the app
291291
yunohost app addaccess vpnclient -u $username
292-
292+
293293
# Rézine related: add some VPN configuration directives
294294
wget http://www.rezine.org/files/config-VPN-propolis.txt -q -O - > /etc/openvpn/client.conf.tpl
295295

@@ -310,13 +310,13 @@ configure_vpnclient() {
310310
yunohost app setting vpnclient server_port -v "1194"
311311
yunohost app setting vpnclient server_proto -v "udp"
312312
yunohost app setting vpnclient service_enabled -v "1"
313-
313+
314314
yunohost app setting vpnclient login_user -v "$vpn_username"
315315
yunohost app setting vpnclient login_passphrase -v "$vpn_pwd"
316-
316+
317317
# Add the service to YunoHost's monitored services
318318
yunohost service add ynh-vpnclient -l /var/log/openvpn-client.log
319-
319+
320320
echo -e "${LGREEN}"
321321
echo -e " ===================== "
322322
echo -e " Restarting OpenVPN..."
@@ -509,7 +509,7 @@ fix_yunohost_services() {
509509
|| echo "nslcd already listed in services"
510510
yunohost service add spamassassin -l /var/log/mail.log \
511511
|| echo "spamassassin already listed in services"
512-
512+
513513
yunohost service remove bind9 || echo "Bind9 already removed"
514514

515515
echo -e "${LBLUE}\e[1m ----> Fait ! \e[21m${NC}"
@@ -537,7 +537,7 @@ add_vpn_restart_cron() {
537537
echo -e " Ajout d'une tâche cron pour s'assurer que le tunnel chiffré fonctionne..."
538538
echo -e " ========================================================================= ${NC}\n"
539539

540-
echo "* * * * * root /sbin/ifconfig tun0 > /dev/null 2>&1 || systemctl restart ynh-vpnclient" > /etc/cron.d/restart-vpn
540+
echo "* * * * * root /bin/ip a s tun0 > /dev/null 2>&1 || systemctl restart ynh-vpnclient" > /etc/cron.d/restart-vpn
541541
echo -e "${LBLUE}\e[1m ----> Fait ! \e[21m${NC}"
542542
}
543543

@@ -557,9 +557,8 @@ configure_DKIM() {
557557
}
558558

559559
display_win_message() {
560-
ip6=$(ifconfig | grep -C4 tun0 | awk '/inet6 addr/{print $3}' | sed 's/\/64//' || echo 'ERROR')
561-
# ip4=$(ifconfig | grep -C4 tun0 | awk '/inet addr/{print substr($2,6)}' || echo 'ERROR')
562-
ip4=$(ifconfig tun0 | grep 'inet adr:' | cut -d: -f2 | awk '{ print $1}' || echo 'ERROR')
560+
ip6=$(ip -6 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
561+
ip4=$(ip -4 addr show tun0 | awk -F'[/ ]' '/inet/{print $6}' || echo 'ERROR')
563562

564563
wget http://www.rezine.org/files/footer-install-propolis.txt -q -O -
565564

@@ -578,7 +577,7 @@ _xmpp-server._tcp 14400 IN SRV 0 5 5269 $domain.
578577
@ 14400 IN TXT "v=spf1 a mx ip4:$ip4 -all""
579578
$(cat /etc/opendkim/keys/$domain/mail.txt > /dev/null 2>&1 || echo '')
580579
echo -e "${LGREEN}__________________________________________________________________________${GRAY}
581-
(Pour d'avantage d'information sur la configuration des DNS, visitez
580+
(Pour d'avantage d'information sur la configuration des DNS, visitez
582581
cette page : ${LBLUE}http://www.rezine.org/documentation/propolis${GRAY})"
583582

584583
if [ ! -z "$additional_domain" ]; then
@@ -588,7 +587,7 @@ cette page : ${LBLUE}http://www.rezine.org/documentation/propolis${GRAY})"
588587
echo -e "
589588
\n${LGREEN}--> Et n'oubliez pas de changer :
590589
__________________________________________________________________________${NC}
591-
590+
592591
* Le mot de passe d'administration via l'interface Web de la Propolis :
593592
${LBLUE}http://${domain}/yunohost/admin/#/tools/adminpw${NC}
594593
@@ -597,7 +596,7 @@ __________________________________________________________________________${NC}
597596
598597
* Le(s) mot(s) de passe Wifi (WPA2) via l'interface Web de la Propolis :
599598
${LBLUE}http://${domain}/wifiadmin${NC}
600-
599+
601600
* Et si vous ne l'avez pas fait, le mot de passe root avec la commande :
602601
${RED}passwd${LGREEN}
603602
__________________________________________________________________________${NC}"

0 commit comments

Comments
 (0)