summaryrefslogtreecommitdiff
path: root/setup-interfaces.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-09-13 14:42:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-09-13 14:54:54 +0000
commit292789f180e446cd516e9ebc21d8c6e0db93c7b2 (patch)
treecb2f24ba0ab01b760d98e6ffc79c7d3ee55e3b5a /setup-interfaces.in
parent2b14ec8a7101d9f6cd02d45fc4e6c211a381e669 (diff)
downloadalpine-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-xsetup-interfaces.in25
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