commit: 1c5754c32c6568b3aac98de8e2eb2ac12493be3d
parent a2a6b5d5b682caf53727898db4785387e873e8be
Author: Mathieu Goessens <mathieu@breizh-entropy.org>
Date: Mon, 24 Dec 2012 11:38:00 +0100
Use a script to edit /etc/network/interfaces instead of pushing a file (WIP)
Diffstat:
3 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/pkg/widrop-common/DEBIAN/interfaces b/src/pkg/widrop-common/DEBIAN/interfaces
@@ -0,0 +1,11 @@
+# BEGIN WIDROP
+# DO NOT REMOVE THE BEGIN & END LINE
+auto wlan0
+iface wlan0 inet static
+ address 10.42.0.1
+ netmask 255.255.255.0
+# post-up /etc/init.d/hostapd restart
+ hostapd /etc/hostapd.conf
+ post-up /etc/init.d/dnsmasq restart
+ post-up /etc/iptables.sh
+# END WIDROP
diff --git a/src/pkg/widrop-common/DEBIAN/postinst b/src/pkg/widrop-common/DEBIAN/postinst
@@ -12,6 +12,24 @@ case $1 in
echo Allowing password-less authentification
pam-auth-update --package
+
+ echo editing /etc/network/interfaces
+ if grep WIDROP /etc/network/interfaces > /dev/null; then
+ echo
+ echo
+ echo
+ exit 0
+ fi
+
+ if grep wlan0 /etc/network/interfaces > /dev/null; then
+ echo
+ echo It seems that wlan0 is already in /etc/network/interfaces
+ echo Adding a commented version of the config, please activate itby editing the /etc/network/interface file
+ sed s/^/#/ interfaces >> /etc/network/interfaces
+ fi;
+
+ cat interfaces >> /etc/network/interfaces
+
;;
esac
diff --git a/src/pkg/widrop-common/DEBIAN/postrm b/src/pkg/widrop-common/DEBIAN/postrm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case $1 in
+ "remove")
+ sed -i '/# BEGIN WIDROP/,/# END WIDROP/s/\(.*\)\|\\n//' /etc/network/interfaces
+ ;;
+esac
+
+exit 0