diff options
author | James Rayner <james@archlinux.org> | 2009-09-07 12:30:56 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-09-07 12:31:41 +0200 |
commit | 9c412668971c69eae705d4325368b37cb421248e (patch) | |
tree | aef0026c4dc2bff980d38796e51054ca221e8805 /src/network | |
parent | d85c03f497a0c69e85133a1d3d753149b714986b (diff) | |
download | netctl-9c412668971c69eae705d4325368b37cb421248e.tar.gz netctl-9c412668971c69eae705d4325368b37cb421248e.tar.xz |
Read /etc/network.d/interfaces/ when loading profile
* profile is sourced again after doing so, so profile-level assignments
can override
* folded validate_profile into load_profile: the extra source command in
load_profile was redundant, so all that load_profile effectively did
was just call validate_profile
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/network b/src/network index ead501c..a3adaf4 100644 --- a/src/network +++ b/src/network @@ -5,14 +5,8 @@ ### Profile loading ## # load_profile profile -# source the profile -load_profile() { - validate_profile "$1" || return 1 - . "$PROFILE_DIR/$1" -} -# validate_profile profile -# check whether profile exists and is usable -validate_profile() +# source profile, checking whether it exists and is usable +load_profile() { [[ -z "$1" ]] && return 1 if [[ ! -f "$PROFILE_DIR/$1" ]]; then @@ -24,6 +18,10 @@ validate_profile() report_fail "Profile missing an interface to configure" return 1 fi + if [[ -f "$IFACE_DIR/$INTERFACE" ]]; then + . "$IFACE_DIR/$INTERFACE" + . "$PROFILE_DIR/$1" # we want profile settings to override, so need to source profile again + fi if [[ ! -f "$CONN_DIR/$CONNECTION" ]]; then report_fail "$CONNECTION is not a valid connection, check spelling or look at examples" return 1 @@ -309,14 +307,14 @@ check_profile() { set_profile() { if [[ "$1" == "up" ]]; then ( # subshell creates sandbox for sourced variables - . "$PROFILE_DIR/$2" + . "$PROFILE_DIR/$2" # we source profile in order to obtain INTERFACE cp "$PROFILE_DIR/$2" "$STATE_DIR/profiles/" echo "$2" > "$STATE_DIR/last_profile" set_iface up "$INTERFACE" "$2" ) elif [[ "$1" == "down" && -f "$STATE_DIR/profiles/$2" ]]; then # JP: skip if profile not already up ( # subshell - . "$STATE_DIR/profiles/$2" + . "$STATE_DIR/profiles/$2" # we source profile in order to obtain INTERFACE rm "$STATE_DIR/profiles/$2" set_iface down "$INTERFACE" "$2" ) |