Commit 292789f1 authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-interfaces: cleanup

we try to avoid huge if ... else clauses. Put thing in function
this is only to improve readability of code
parent 2b14ec8a
...@@ -112,14 +112,7 @@ __EOF__ ...@@ -112,14 +112,7 @@ __EOF__
exit 1 exit 1
} }
while getopts "hi" opt; do prompt_for_interfaces() {
case $opt in
h) usage;;
i) STDINPUT=1;;
esac
done
if [ "$STDINPUT" != "1" ]; then
init_tmpdir TMP init_tmpdir TMP
cd $TMP cd $TMP
...@@ -185,8 +178,18 @@ if [ "$STDINPUT" != "1" ]; then ...@@ -185,8 +178,18 @@ if [ "$STDINPUT" != "1" ]; then
mkdir -p $ROOT/etc/network mkdir -p $ROOT/etc/network
cp interfaces $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 mkdir -p $ROOT/etc/network
cp interfaces $ROOT/etc/network cat > $ROOT/etc/network/interfaces
else
prompt_for_interfaces
fi fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment