diff options
author | Roy Marples <roy@marples.name> | 2007-12-19 14:28:38 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-12-19 14:28:38 +0000 |
commit | ed620aec61752b35914aec8841a2576ceb69a277 (patch) | |
tree | 1f41d6f09b76c8cbe17f924d49bd17bc44c3659b | |
parent | bc9cc3dfb5c27d30964dc497d7559c134f3893ef (diff) |
get_options -> service_get_value and save_options -> service_set_value
-rw-r--r-- | init.d.BSD/rc-enabled | 4 | ||||
-rw-r--r-- | net.BSD/iwconfig.sh | 4 | ||||
-rw-r--r-- | net.Linux/ccwgroup.sh | 6 | ||||
-rw-r--r-- | net.Linux/iwconfig.sh | 4 | ||||
-rw-r--r-- | net.Linux/tuntap.sh | 6 | ||||
-rw-r--r-- | net/wpa_supplicant.sh | 6 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/rc.c | 19 |
8 files changed, 28 insertions, 23 deletions
diff --git a/init.d.BSD/rc-enabled b/init.d.BSD/rc-enabled index 466146cb..6e9da965 100644 --- a/init.d.BSD/rc-enabled +++ b/init.d.BSD/rc-enabled @@ -53,7 +53,7 @@ start() { "$svc" start && started="${started} ${svc}" : $((retval += $?)) done - save_options started "${started}" + service_set_value started "${started}" eend $retval "Some local rc services failed to start" return 0 } @@ -61,7 +61,7 @@ start() { stop() { ebegin "Stopping local rc services" local svc= retval=0 - for svc in $(rcorder $(get_options started) 2>/dev/null | sort -r); do + for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do "${svc}" stop : $((retval += $?)) done diff --git a/net.BSD/iwconfig.sh b/net.BSD/iwconfig.sh index d33af4c9..e784b37f 100644 --- a/net.BSD/iwconfig.sh +++ b/net.BSD/iwconfig.sh @@ -555,7 +555,7 @@ iwconfig_pre_start() { # the background yesno ${IN_BACKGROUND} && return 0 - save_options "SSID" "" + service_set_value "SSID" "" _exists || return 0 if ! _is_wireless ; then @@ -572,7 +572,7 @@ iwconfig_pre_start() { einfo "Configuring wireless network for ${IFACE}" if iwconfig_configure ; then - save_options "SSID" "${SSID}" + service_set_value "SSID" "${SSID}" return 0 fi diff --git a/net.Linux/ccwgroup.sh b/net.Linux/ccwgroup.sh index 461b306d..98d3d561 100644 --- a/net.Linux/ccwgroup.sh +++ b/net.Linux/ccwgroup.sh @@ -59,7 +59,7 @@ ccwgroup_pre_start() { ccwgroup_pre_stop() { # Erase any existing ccwgroup to be safe - save_options ccwgroup_device "" + service_set_value ccwgroup_device "" [ ! -L /sys/class/net/"${FACE}"/driver ] && return 0 local driver="$(readlink /sys/class/net/"${IFACE}"/driver)" @@ -70,11 +70,11 @@ ccwgroup_pre_stop() { local device="$(readlink /sys/class/net/"${IFACE}"/device)" device=${device##*/} - save_options ccwgroup_device "${device}" + service_set_value ccwgroup_device "${device}" } ccwgroup_post_stop() { - local device="$(get_options ccwgroup_device)" + local device="$(service_get_value ccwgroup_device)" [ -z "${device}" ] && return 0 einfo "Disabling ccwgroup on ${iface}" diff --git a/net.Linux/iwconfig.sh b/net.Linux/iwconfig.sh index cb94912a..272d1fb9 100644 --- a/net.Linux/iwconfig.sh +++ b/net.Linux/iwconfig.sh @@ -686,7 +686,7 @@ iwconfig_pre_start() { # the background yesno ${IN_BACKGROUND} && return 0 - save_options "SSID" "" + service_set_value "SSID" "" _exists || return 0 if ! _is_wireless; then @@ -736,7 +736,7 @@ iwconfig_pre_start() { fi if iwconfig_configure; then - save_options "SSID" "${SSID}" + service_set_value "SSID" "${SSID}" return 0 fi diff --git a/net.Linux/tuntap.sh b/net.Linux/tuntap.sh index 07aa2a54..d0fa5a89 100644 --- a/net.Linux/tuntap.sh +++ b/net.Linux/tuntap.sh @@ -29,7 +29,7 @@ tuntap_depend() { _config_vars="$_config_vars tunctl" _is_tuntap() { - [ -n "$(get_options tuntap "${SVCNAME}")" ] + [ -n "$(export SVCNAME="net.${IFACE}"; service_get_value tuntap)" ] } tuntap_pre_start() { @@ -58,7 +58,7 @@ tuntap_pre_start() { else openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" >/dev/null fi - eend $? && _up && save_options tuntap "${tuntap}" + eend $? && _up && service_set_value tuntap "${tuntap}" } tuntap_post_stop() { @@ -69,7 +69,7 @@ tuntap_post_stop() { tunctl -d "${IFACE}" >/dev/null else openvpn --rmtun \ - --dev-type "$(get_options tuntap)" \ + --dev-type "$(service_get_value tuntap)" \ --dev "${IFACE}" >/dev/null fi eend $? diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh index a75f04a5..e18ffcb6 100644 --- a/net/wpa_supplicant.sh +++ b/net/wpa_supplicant.sh @@ -83,13 +83,13 @@ wpa_supplicant_pre_start() { if ${wireless} && service_started_daemon "${SVCNAME}" "${wpas}"; then SSID=$(_get_ssid "${IFACE}") SSIDVAR=$(_shell_var "${SSID}") - save_options "SSID" "${SSID}" + service_set_value "SSID" "${SSID}" metric=2000 fi return 0 fi - save_options "SSID" "" + service_set_value "SSID" "" ebegin "Starting wpa_supplicant on ${IFVAR}" if [ -x /sbin/iwconfig ]; then @@ -134,7 +134,7 @@ wpa_supplicant_pre_start() { opts="${opts} -C ${ctrl_dir}" fi fi - save_options ctrl_dir "${ctrl_dir}" + service_set_value ctrl_dir "${ctrl_dir}" actfile="/etc/wpa_supplicant/wpa_cli.sh" diff --git a/src/Makefile b/src/Makefile index a103679b..602e2320 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,7 +69,7 @@ RC_BINLINKS = einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \ service_inactive service_wasinactive \ service_coldplugged \ checkown fstabinfo mountinfo rc-depend \ - get_options save_options + service_get_value service_set_value get_options save_options RC_SBINLINKS = mark_service_starting mark_service_started \ mark_service_stopping mark_service_stopped \ mark_service_inactive mark_service_wasinactive \ @@ -391,7 +391,7 @@ static int do_mark_service (int argc, char **argv) return (ok ? EXIT_SUCCESS : EXIT_FAILURE); } -static int do_options (int argc, char **argv) +static int do_value (int argc, char **argv) { bool ok = false; char *service = getenv ("SVCNAME"); @@ -402,14 +402,17 @@ static int do_options (int argc, char **argv) if (argc < 1 || ! argv[0] || strlen (argv[0]) == 0) eerrorx ("%s: no option specified", applet); - if (strcmp (applet, "get_options") == 0) { + if (strcmp (applet, "service_get_value") == 0 || + strcmp (applet, "get_options") == 0) + { char *option = rc_service_value_get (service, argv[0]); if (option) { printf ("%s", option); free (option); ok = true; } - } else if (strcmp (applet, "save_options") == 0) + } else if (strcmp (applet, "service_set_value") == 0 || + strcmp (applet, "save_options") == 0) ok = rc_service_value_set (service, argv[0], argv[1]); else eerrorx ("%s: unknown applet", applet); @@ -846,13 +849,15 @@ int main (int argc, char **argv) if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) exit (do_e (argc, argv)); + if (strcmp (applet, "get_value") == 0 || + strcmp (applet, "set_value") == 0 || + strcmp (applet, "get_options") == 0 || + strcmp (applet, "save_options") == 0) + exit (do_value (argc, argv)); + if (strncmp (applet, "service_", strlen ("service_")) == 0) exit (do_service (argc, argv)); - if (strcmp (applet, "get_options") == 0 || - strcmp (applet, "save_options") == 0) - exit (do_options (argc, argv)); - if (strncmp (applet, "mark_service_", strlen ("mark_service_")) == 0) exit (do_mark_service (argc, argv)); |