summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-11-16 11:47:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2021-11-16 12:01:54 +0000
commit6c7008883edb9d3f3633728b8e38d286bcd536e3 (patch)
tree6e510d3d4faa86cfb53dce87d42627fc863ff9ec
parentb7b8b76bff1421e5652f5c91969916af023ea9f5 (diff)
downloadalpine-conf-6c7008883edb9d3f3633728b8e38d286bcd536e3.zip
setup-alpine: minor code clean up
No functional changes, just clean up code a bit.
-rw-r--r--setup-alpine.in24
1 files changed, 12 insertions, 12 deletions
diff --git a/setup-alpine.in b/setup-alpine.in
index a9859d0..0793082 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -48,24 +48,24 @@ if [ "$rc_sys" = "XENU" ] && ! grep -q '^xenfs' /proc/mounts; then
mount -t xenfs xenfs /proc/xen
fi
-if [ "$USEANSWERFILE" != "" ]; then
- # dynamically download answer file from URL (supports HTTP(S) and FTP)
- if [ -z "$(echo "$USEANSWERFILE" | sed -E 's~^(https?|ftp)://.+$~~')" ]; then
+case "$USEANSWERFILE" in
+ http*://*|ftp://*)
+ # dynamically download answer file from URL (supports HTTP(S) and FTP)
# ensure the network is up, otherwise setup a temporary interface config
- network_status="$(/etc/init.d/networking status)"
- [ -z "${network_status##*started*}" ] || $PREFIX/sbin/setup-interfaces -ar
+ if ! rc-status networking --quiet status; then
+ $PREFIX/sbin/setup-interfaces -ar
+ fi
temp="$(mktemp)"
wget -qO "$temp" "$USEANSWERFILE" || die "Failed to download '$USEANSWERFILE'"
USEANSWERFILE="$temp"
- fi
-
- if [ -e "$USEANSWERFILE" ]; then
- . "$USEANSWERFILE"
- fi
+ ;;
+esac
+if [ -n "$USERANSERFILE" ] && [ -e "$USEANSWERFILE" ]; then
+ . "$USEANSWERFILE"
fi
-if [ "$CREATEANSWERFILE" != "" ]; then
+if [ -n "$CREATEANSWERFILE" ]; then
touch "$CREATEANSWERFILE" || echo "Cannot touch file $CREATEANSWERFILE"
cat > "$CREATEANSWERFILE" <<-__EOF__
# Example answer file for setup-alpine script
@@ -159,7 +159,7 @@ for svc in acpid cron crond; do
done
# enable new hostname
-/etc/init.d/hostname --quiet restart
+rc-service hostname --quiet restart
# start up the services
openrc boot