summaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-04-15 11:51:43 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2012-04-15 11:51:43 +0200
commit6ed6803d0dd8cd3fc93208d614c3558b962a654e (patch)
tree2cdb4c71787965334f7be6352c5a12c757d30c1b /rc.d
parentc96f443ea84f8041c4b1bdea56f36d9a0d827cf6 (diff)
downloadnetctl-6ed6803d0dd8cd3fc93208d614c3558b962a654e.tar.gz
netctl-6ed6803d0dd8cd3fc93208d614c3558b962a654e.tar.xz
Restore support for kernel command line
It is once again possible to use NET= at the kernel command line when using net-profiles.
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/net-profiles26
-rw-r--r--rc.d/net-set-variable10
2 files changed, 21 insertions, 15 deletions
diff --git a/rc.d/net-profiles b/rc.d/net-profiles
index 66f0851..ae9c00e 100755
--- a/rc.d/net-profiles
+++ b/rc.d/net-profiles
@@ -14,7 +14,7 @@ case "$1" in
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [[ "$daemon" = "net-rename" ]]; then
+ if [[ $daemon = net-rename ]]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi
@@ -22,23 +22,19 @@ case "$1" in
done
# $NET env var is passed from the kernel boot line
- if [[ "$NET" = "menu" ]]; then
- if /usr/bin/netcfg-menu; then
- mv "$STATE_DIR"/{menu,netcfg-daemon} # JP: user may want to disconnect profile by calling net-profiles stop
- add_daemon net-profiles
- exit 0
+ if [[ -n $NET ]]; then
+ # Record the connected profile for net-profiles stop
+ if [[ $NET = menu ]]; then
+ /usr/bin/netcfg-menu || exit 1
+ mv "$STATE_DIR"/{menu,netcfg-daemon}
+ else
+ /usr/bin/netcfg check-iface "$NET" || exit 1
+ echo "$NET" > "$STATE_DIR/netcfg-daemon"
fi
- elif [[ -n "$NET" ]]; then
- if /usr/bin/netcfg check-iface "$NET"; then
- echo "$NET" > "$STATE_DIR/netcfg-daemon" # JP: user may want to disconnect profile by calling net-profiles stop
- add_daemon net-profiles
- exit 0
- fi
- elif /usr/bin/netcfg-daemon start; then
- add_daemon net-profiles
- else
+ elif ! /usr/bin/netcfg-daemon start; then
exit_err "No profile started."
fi
+ add_daemon net-profiles
;;
stop)
if ck_daemon net-profiles; then
diff --git a/rc.d/net-set-variable b/rc.d/net-set-variable
new file mode 100644
index 0000000..cc881e7
--- /dev/null
+++ b/rc.d/net-set-variable
@@ -0,0 +1,10 @@
+# Set the NET variable if specified on the kernel command line.
+
+net-set-variable() {
+ local re="\<NET=([^ ]+)\>"
+ if [[ -f /proc/cmdline && $(< /proc/cmdline) =~ $re ]]; then
+ export NET=${BASH_REMATCH[1]}
+ fi
+}
+
+add_hook multi_start net-set-variable