diff options
author | Silvino Silva <silvino@bk.ru> | 2016-08-22 21:41:57 +0100 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2016-08-22 21:41:57 +0100 |
commit | 94e429f914be777770cf8094d728008a5efcf6ff (patch) | |
tree | 7ca8aab9588280a01ab435df90b2f87aef91a6db /core/conf | |
parent | 34759446ef0c8494ebf3195d558832de2a3729cd (diff) | |
download | doc-94e429f914be777770cf8094d728008a5efcf6ff.tar.gz |
added all core files
Diffstat (limited to 'core/conf')
-rwxr-xr-x | core/conf/rc.d/net | 50 | ||||
-rwxr-xr-x | core/conf/rc.d/wlan | 55 |
2 files changed, 105 insertions, 0 deletions
diff --git a/core/conf/rc.d/net b/core/conf/rc.d/net new file mode 100755 index 0000000..d111a25 --- /dev/null +++ b/core/conf/rc.d/net @@ -0,0 +1,50 @@ +#!/bin/sh +# +# /etc/rc.d/net: start/stop network interface +# + +# Connection type: "DHCP" or "static" +TYPE="static" + +# For "static" connections, specify your settings here: +# To see your available devices run "ip link". +DEV=enp8s0 +ADDR=192.168.1.33 +MASK=24 +GW=192.168.1.1 + +# Optional settings: +DHCPOPTS="-h $(/bin/hostname) -C resolv.conf $DEV" + +case $1 in + start) + if [ "${TYPE}" = "DHCP" ]; then + /sbin/dhcpcd ${DHCPOPTS} + else + /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast + + /sbin/ip link set ${DEV} up + /sbin/ip route add default via ${GW} + fi + ;; + stop) + if [ "${TYPE}" = "DHCP" ]; then + /usr/bin/pkill -F /var/run/dhcpcd-${DEV}.pid + + else + # /sbin/ip route del default + /sbin/ip route flush dev ${DEV} + /sbin/ip link set ${DEV} down + # /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV} + /sbin/ip addr flush dev ${DEV} + fi + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/core/conf/rc.d/wlan b/core/conf/rc.d/wlan new file mode 100755 index 0000000..263cf42 --- /dev/null +++ b/core/conf/rc.d/wlan @@ -0,0 +1,55 @@ +#!/bin/sh +# +# /etc/rc.d/wlan: start/stop wireless interface +# +DEV=wlp7s0 + +SSD=/sbin/start-stop-daemon +PROG_DHCP=/sbin/dhcpcd +PROG_WIFI=/usr/sbin/wpa_supplicant +PID_DHCP=/var/run/dhcpcd-${DEV}.pid +PID_WIFI=/var/run/wpa_supplicant.pid + +OPTS_DHCP="-h $(/bin/hostname) -C resolv.conf $DEV" +OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV" + +print_status() { + $SSD --status --pidfile $2 + case $? in + 0) echo "$1 is running with pid $(cat $2)" ;; + 1) echo "$1 is not running but the pid file $2 exists" ;; + 3) echo "$1 is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac +} + +case $1 in + start) + $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \ + $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP + RETVAL=$? + ;; + stop) + ( $SSD --stop --retry 10 --pidfile $PID_DHCP + $SSD --stop --retry 10 --pidfile $PID_WIFI ) + RETVAL=$? + /sbin/ip link set ${DEV} down + /sbin/ip addr flush dev ${DEV} + ;; + restart) + $0 stop + $0 start + ;; + status) + print_status $PROG_WIFI $PID_WIFI + print_status $PROG_DHCP $PID_DHCP + ;; + *) + echo "Usage: $0 [start|stop|restart|status]" + ;; +esac + +exit $RETVAL + +# End of file + |