diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-13 14:42:29 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-13 14:54:54 +0000 |
commit | 292789f180e446cd516e9ebc21d8c6e0db93c7b2 (patch) | |
tree | cb2f24ba0ab01b760d98e6ffc79c7d3ee55e3b5a /setup-interfaces.in | |
parent | 2b14ec8a7101d9f6cd02d45fc4e6c211a381e669 (diff) | |
download | alpine-conf-292789f180e446cd516e9ebc21d8c6e0db93c7b2.zip |
setup-interfaces: cleanup
we try to avoid huge if ... else clauses. Put thing in function
this is only to improve readability of code
Diffstat (limited to 'setup-interfaces.in')
-rwxr-xr-x | setup-interfaces.in | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in index 2cde104..b461529 100755 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -112,14 +112,7 @@ __EOF__ exit 1 } -while getopts "hi" opt; do - case $opt in - h) usage;; - i) STDINPUT=1;; - esac -done - -if [ "$STDINPUT" != "1" ]; then +prompt_for_interfaces() { init_tmpdir TMP cd $TMP @@ -185,8 +178,18 @@ if [ "$STDINPUT" != "1" ]; then mkdir -p $ROOT/etc/network cp interfaces $ROOT/etc/network/ -else - cat /dev/stdin > interfaces +} + +while getopts "hi" opt; do + case $opt in + h) usage;; + i) STDINPUT=1;; + esac +done + +if [ "$STDINPUT" = "1" ]; then mkdir -p $ROOT/etc/network - cp interfaces $ROOT/etc/network + cat > $ROOT/etc/network/interfaces +else + prompt_for_interfaces fi |