summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--lbu.in2
-rw-r--r--libalpine.sh.in41
-rw-r--r--setup-alpine.in3
-rw-r--r--setup-apkcache.in9
-rw-r--r--setup-apkrepos.in10
-rw-r--r--setup-bootable.in5
-rw-r--r--setup-disk.in10
-rw-r--r--setup-dns.in15
-rw-r--r--setup-gparted-desktop.in1
-rw-r--r--setup-hostname.in9
-rw-r--r--setup-interfaces.in14
-rw-r--r--setup-lbu.in10
-rw-r--r--setup-mta.in1
-rw-r--r--setup-ntp.in15
-rw-r--r--setup-proxy.in3
-rw-r--r--setup-sshd.in11
-rw-r--r--setup-timezone.in11
-rw-r--r--setup-xfce-desktop1
-rw-r--r--setup-xfce-desktop.in1
-rw-r--r--setup-xorg-base.in1
-rw-r--r--uniso.c12
-rw-r--r--update-conf.in10
-rw-r--r--update-kernel.in248
24 files changed, 216 insertions, 236 deletions
diff --git a/Makefile b/Makefile
index 5e4e26b..00639a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION := 3.4.1
-sysconfdir ?= /etc/lbu
+sysconfdir ?= /etc/lbu
PREFIX ?=
@@ -36,10 +36,10 @@ ETC_LBU_FILES := lbu.conf
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
-FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
-FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
+FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
+FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
else
-FULL_VERSION := $(VERSION)
+FULL_VERSION := $(VERSION)
endif
@@ -88,4 +88,3 @@ uninstall:
clean:
rm -rf $(SCRIPTS) $(BIN_FILES)
-
diff --git a/lbu.in b/lbu.in
index 0c70d1a..81eef2e 100644
--- a/lbu.in
+++ b/lbu.in
@@ -206,7 +206,7 @@ unpack_apkovl() {
return
fi
check_openssl
- while [ $count -lt 3 ]; do
+ while [ $count -lt 3 ]; do
$OPENSSL enc -d -$ENCRYPTION -in "$mnt/$f" | tar \
-C "$dest" -zx 2>/dev/null && return 0
count=$(( $count + 1 ))
diff --git a/libalpine.sh.in b/libalpine.sh.in
index 67d7aa1..760eaec 100644
--- a/libalpine.sh.in
+++ b/libalpine.sh.in
@@ -98,26 +98,26 @@ is_xen_dom0() {
# list of available network interfaces that aren't part of any bridge or bond
available_ifaces() {
- local iflist= ifpath= iface= i=
+ local iflist= ifpath= iface= i=
if ! [ -d /sys/class/net ]; then
ip link | awk -F: '$1 ~ /^[0-9]+$/ {printf "%s",$2}'
return
fi
- sorted_ifindexes=$(
- for i in /sys/class/net/*/ifindex; do
- [ -e "$i" ] || continue
- echo -e "$(cat $i)\t$i";
- done | sort -n | awk '{print $2}')
- for i in $sorted_ifindexes; do
- ifpath=${i%/*}
- iface=${ifpath##*/}
- # skip interfaces that are part of a bond or bridge
- if [ -d "$ifpath"/master/bonding ] || [ -d "$ifpath"/brport ]; then
- continue
- fi
- iflist="${iflist}${iflist:+ }$iface"
- done
- echo $iflist
+ sorted_ifindexes=$(
+ for i in /sys/class/net/*/ifindex; do
+ [ -e "$i" ] || continue
+ echo -e "$(cat $i)\t$i";
+ done | sort -n | awk '{print $2}')
+ for i in $sorted_ifindexes; do
+ ifpath=${i%/*}
+ iface=${ifpath##*/}
+ # skip interfaces that are part of a bond or bridge
+ if [ -d "$ifpath"/master/bonding ] || [ -d "$ifpath"/brport ]; then
+ continue
+ fi
+ iflist="${iflist}${iflist:+ }$iface"
+ done
+ echo $iflist
}
# from OpenBSD installer
@@ -168,7 +168,7 @@ isin() {
# remove all occurrences of first argument from list formed by
# the remaining arguments
rmel() {
- local _a=$1 _b
+ local _a=$1 _b
shift
for _b; do
@@ -176,17 +176,17 @@ rmel() {
done
}
-# Issue a read into the global variable $resp.
+# Issue a read into the global variable $resp.
_ask() {
local _redo=0
read resp
case "$resp" in
- !) echo "Type 'exit' to return to setup."
+ !) echo "Type 'exit' to return to setup."
sh
_redo=1
;;
- !*) eval "${resp#?}"
+ !*) eval "${resp#?}"
_redo=1
;;
esac
@@ -266,4 +266,3 @@ ask_which() {
echo "'$resp' is not a valid choice."
done
}
-
diff --git a/setup-alpine.in b/setup-alpine.in
index c120c99..4aa5da3 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -33,7 +33,7 @@ options:
-h Show this help
-q Quick mode. Ask fewer questions.
__EOF__
- exit 1
+ exit 1
}
while getopts "af:c:hq" opt ; do
@@ -211,4 +211,3 @@ if [ "$diskmode" != "sys" ]; then
apk cache sync
fi
fi
-
diff --git a/setup-apkcache.in b/setup-apkcache.in
index 5210d82..d4bfb39 100644
--- a/setup-apkcache.in
+++ b/setup-apkcache.in
@@ -5,7 +5,7 @@ PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-apkcache [-h] [DIR]
Setup apk caching.
@@ -15,7 +15,7 @@ If DIR is not specified user will be asked for location.
options:
-h Show this help
__EOF__
- exit 1
+ exit 1
}
is_mounted() {
@@ -97,9 +97,9 @@ __EOF__
}
while getopts "h" opt; do
- case $opt in
+ case $opt in
h) usage;;
- esac
+ esac
done
shift $(( $OPTIND - 1 ))
@@ -165,4 +165,3 @@ case "$cleanup" in
umount) umount $mount;;
remount) mount -o remount,ro $mount;;
esac
-
diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index 136dcf8..8c5e1e6 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -158,11 +158,11 @@ __EOF__
}
while getopts "fhr" opt; do
- case $opt in
- f) JUSTADDFASTEST=1;;
- h) usage;;
- r) JUSTADDRANDOM=1;;
- esac
+ case $opt in
+ f) JUSTADDFASTEST=1;;
+ h) usage;;
+ r) JUSTADDRANDOM=1;;
+ esac
done
shift $(($OPTIND - 1))
diff --git a/setup-bootable.in b/setup-bootable.in
index 35a5f73..205aa1b 100644
--- a/setup-bootable.in
+++ b/setup-bootable.in
@@ -98,14 +98,14 @@ find_syslinux_cfg() {
fix_syslinux_kernel() {
echo "Fixing $syslinux_cfg: kernel $1 -> $2"
sed -i -e "/^\s*[Kk][Ee][Rr][Nn][Ee][Ll]\s/s|$1|$2|" \
- "$destdir/$syslinux_cfg"
+ "$destdir/$syslinux_cfg"
}
fix_syslinux_initrd() {
echo "Fixing $syslinux_cfg: initrd $1 -> $2"
sed -i -e "/^\s*[Ii][Nn][Ii][Tt][Rr][Dd]\s/s|$1|$2|" \
-e "/^\s*[Aa][Pp][Pp][Ee][Nn][Dd]\s/s|initrd=$1|initrd=$2|" \
- "$destdir/$syslinux_cfg"
+ "$destdir/$syslinux_cfg"
}
check_syslinux() {
@@ -408,4 +408,3 @@ else
echo "Warning: Could not find the parent device for $dest"
fi
cleanup_installs
-
diff --git a/setup-disk.in b/setup-disk.in
index 3ab35cd..7fbf080 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -903,7 +903,7 @@ ask_disk() {
if ! [ -b "/dev/$i" ]; then
echo "/dev/$i is not a block device" >&2
answer=
- fi
+ fi
done;;
esac
done
@@ -912,7 +912,7 @@ ask_disk() {
usage() {
cat <<__EOF__
usage: setup-disk [-hLqrv] [-k kernelflavor] [-m MODE] [-o apkovl] [-s SWAPSIZE]
- [MOUNTPOINT | DISKDEV...]
+ [MOUNTPOINT | DISKDEV...]
Install alpine on harddisk.
@@ -946,9 +946,9 @@ __EOF__
kver=$(uname -r)
case $kver in
- *-rc[0-9]*) KERNEL_FLAVOR=vanilla;;
- *-[a-z]*) KERNEL_FLAVOR=${kver##*-};;
- *) KERNEL_FLAVOR=vanilla;;
+ *-rc[0-9]*) KERNEL_FLAVOR=vanilla;;
+ *-[a-z]*) KERNEL_FLAVOR=${kver##*-};;
+ *) KERNEL_FLAVOR=vanilla;;
esac
DISK_MODE=
diff --git a/setup-dns.in b/setup-dns.in
index fbcce70..06568f6 100644
--- a/setup-dns.in
+++ b/setup-dns.in
@@ -4,7 +4,7 @@ PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-dns [-h] [-d domain name] [IPADDR...]
Setup ${ROOT}etc/resolv.conf DNS settings
@@ -15,15 +15,15 @@ options:
The optional IPADDR are a list of DNS servers to use.
__EOF__
- exit 1
+ exit 1
}
while getopts "d:n:h" opt; do
- case $opt in
- d) DOMAINNAME="$OPTARG";;
- h) usage;;
- n) NAMESERVERS="$OPTARG";;
- esac
+ case $opt in
+ d) DOMAINNAME="$OPTARG";;
+ h) usage;;
+ n) NAMESERVERS="$OPTARG";;
+ esac
done
shift $(($OPTIND - 1))
@@ -65,4 +65,3 @@ for i in $dns $@; do
mkdir -p "${conf%/*}"
echo "nameserver $i" >> $conf
done
-
diff --git a/setup-gparted-desktop.in b/setup-gparted-desktop.in
index 37cefe6..849aacc 100644
--- a/setup-gparted-desktop.in
+++ b/setup-gparted-desktop.in
@@ -39,4 +39,3 @@ EOF
echo ""
echo " To start GParted run: startx"
echo ""
-
diff --git a/setup-hostname.in b/setup-hostname.in
index 20164bd..04420ac 100644
--- a/setup-hostname.in
+++ b/setup-hostname.in
@@ -6,7 +6,7 @@ PREFIX=
. $PREFIX/lib/libalpine.sh
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-hostname [-h] [HOSTNAME]
Sets the system hostname.
@@ -16,7 +16,7 @@ options:
Sets hostname to HOSTNAME or prompt if unspecified.
__EOF__
- exit 1
+ exit 1
}
@@ -40,10 +40,10 @@ valid_hostname() {
}
while getopts "hn:" opt; do
- case $opt in
+ case $opt in
h) usage;;
n) name="$OPTARG";;
- esac
+ esac
done
shift $(( $OPTIND - 1 ))
if [ -z "$name" ] && [ $# -eq 1 ]; then
@@ -67,4 +67,3 @@ done
mkdir -p "$ROOT/etc"
echo "$HOST" > "$ROOT/etc/hostname"
-
diff --git a/setup-interfaces.in b/setup-interfaces.in
index b4121d5..a1ab283 100644
--- a/setup-interfaces.in
+++ b/setup-interfaces.in
@@ -208,7 +208,7 @@ config_iface() {
raw_device=$(cat $iface.raw_device)
echo "raw_device=\"$raw_device\"" >> $conf
fi
- if is_wifi $iface; then
+ if is_wifi $iface; then
apk add --quiet --no-progress wireless-tools wpa_supplicant || prompt_for_interfaces
echo "Available wireless networks (scanning):"
if find_essids $iface; then
@@ -223,7 +223,7 @@ config_iface() {
echo -e "\nNo available wireless networks\n"
prompt_for_interfaces
fi
- fi
+ fi
# use ipcalc to validate the address. we do accept /mask
# we are no interested in the result, only error code, so
# we send result to /dev/null
@@ -407,7 +407,7 @@ config_vlan() {
}
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-interfaces [-bhi]
Setup network interfaces
@@ -417,7 +417,7 @@ options:
-h Show this help
-i Read new contents of ${ROOT}etc/network/interfaces from stdin
__EOF__
- exit 1
+ exit 1
}
iface_help() {
@@ -553,12 +553,12 @@ ask_bridge=
is_xen_dom0 && ask_bridge=1
while getopts "bhip:" opt; do
- case $opt in
+ case $opt in
b) ask_bridge=1;;
- h) usage;;
+ h) usage;;
i) STDINPUT=1;;
p) ROOT=$OPTARG;;
- esac
+ esac
done
mkdir -p $ROOT/etc/network
diff --git a/setup-lbu.in b/setup-lbu.in
index d5c10ff..7270f3b 100644
--- a/setup-lbu.in
+++ b/setup-lbu.in
@@ -5,7 +5,7 @@ PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-lbu [-hq] [MEDIA]
Setup lbu media settings.
@@ -17,7 +17,7 @@ options:
-q Quietly pick best suggestion. Only prompts user if unsure.
__EOF__
- exit 1
+ exit 1
}
get_mnt_line() {
@@ -94,10 +94,10 @@ set_media() {
}
while getopts "hq" opt; do
- case $opt in
+ case $opt in
h) usage;;
q) quiet=1;;
- esac
+ esac
done
shift $(($OPTIND - 1))
@@ -146,5 +146,3 @@ if [ "$media" = "none" ]; then
fi
set_media "$media"
-
-
diff --git a/setup-mta.in b/setup-mta.in
index 214387e..8a3f544 100644
--- a/setup-mta.in
+++ b/setup-mta.in
@@ -48,4 +48,3 @@ apk add ssmtp
setcfg mailhub $mailhub
setcfg FromLineOverride YES
-
diff --git a/setup-ntp.in b/setup-ntp.in
index b544a2a..4432cbc 100644
--- a/setup-ntp.in
+++ b/setup-ntp.in
@@ -5,7 +5,7 @@ PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-ntp [-h] [-c choice of NTP daemon]
Setup NTP time synchronization
@@ -14,19 +14,19 @@ options:
-h Show this help
-c Choice of NTP daemon: busybox openntpd chrony none
__EOF__
- exit 1
+ exit 1
}
while getopts "hc:" opt; do
- case $opt in
- c) ntpchoice="$OPTARG";;
+ case $opt in
+ c) ntpchoice="$OPTARG";;
h) usage;;
- esac
+ esac
done
if [ -z "$ntpchoice" ]; then
- echo -n "Which NTP client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony] "
- default_read ntpchoice "chrony"
+ echo -n "Which NTP client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony] "
+ default_read ntpchoice "chrony"
fi
pkgs="$ntpchoice"
@@ -53,4 +53,3 @@ esac
[ -z "$pkgs" ] || apk add --quiet $pkgs
rc-update add $svc default
rc-service $svc start
-
diff --git a/setup-proxy.in b/setup-proxy.in
index e75aff4..16b7968 100644
--- a/setup-proxy.in
+++ b/setup-proxy.in
@@ -17,7 +17,7 @@ options:
If PROXYURL is not specified user will be prompted.
__EOF__
- exit 1
+ exit 1
}
@@ -68,4 +68,3 @@ fi
if [ -z "$quiet" ]; then
echo -e "\nTo make changes active please do login again or source $PROFILE\nwith \". $PROFILE\""
fi
-
diff --git a/setup-sshd.in b/setup-sshd.in
index 1890b7c..d9ae94f 100644
--- a/setup-sshd.in
+++ b/setup-sshd.in
@@ -5,7 +5,7 @@ PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-sshd [-h] [-c choice of SSH daemon]
Setup sshd daemon
@@ -14,14 +14,14 @@ options:
-h Show this help
-c Choice of SSH daemon: openssh dropbear none
__EOF__
- exit 1
+ exit 1
}
while getopts "hc:" opt; do
- case $opt in
+ case $opt in
h) usage;;
c) sshdchoice="$OPTARG";;
- esac
+ esac
done
if [ "$sshdchoice" = "" ]; then
@@ -29,7 +29,7 @@ if [ "$sshdchoice" = "" ]; then
default_read sshdchoice "openssh"
fi
-if [ "$sshdchoice" = "none" ]; then
+if [ "$sshdchoice" = "none" ]; then
exit 0
fi
@@ -50,4 +50,3 @@ if [ -n "$svc" ]; then
rc-update add $svc default
rc-service $svc start
fi
-
diff --git a/setup-timezone.in b/setup-timezone.in
index 514f9ca..2d7b044 100644
--- a/setup-timezone.in
+++ b/setup-timezone.in
@@ -7,7 +7,7 @@ PREFIX=
zroot=/usr/share/zoneinfo
usage() {
- cat <<__EOF__
+ cat <<__EOF__
usage: setup-timezone [-h] [-k|-i] [-z TIMEZONE]
Sets the timezone for the system.
@@ -18,7 +18,7 @@ options:
-k Keep previous copies of tzdata
-z Set given timezone. (relative $zroot)
__EOF__
- exit 1
+ exit 1
}
show_tz_list() {
@@ -60,12 +60,12 @@ setup_tz() {
INSTALL_TZDATA=false
KEEP_TZDATA=false
while getopts "hikz:" opt; do
- case $opt in
- h) usage;;
+ case $opt in
+ h) usage;;
i) INSTALL_TZDATA=true;;
k) KEEP_TZDATA=true;;
z) ZONE="$OPTARG";;
- esac
+ esac
done
if $INSTALL_TZDATA; then
@@ -119,4 +119,3 @@ done
if [ -n "$apkdel" ]; then
apk del --quiet $apkdel
fi
-
diff --git a/setup-xfce-desktop b/setup-xfce-desktop
index 2a2ce2d..773e807 100644
--- a/setup-xfce-desktop
+++ b/setup-xfce-desktop
@@ -3,4 +3,3 @@
videodrivers=$(apk search --quiet --exact xf86-video* | grep -v -- '-doc$')
setup-xorg-base $videodrivers xfce4 firefox slim
-
diff --git a/setup-xfce-desktop.in b/setup-xfce-desktop.in
index 2a2ce2d..773e807 100644
--- a/setup-xfce-desktop.in
+++ b/setup-xfce-desktop.in
@@ -3,4 +3,3 @@
videodrivers=$(apk search --quiet --exact xf86-video* | grep -v -- '-doc$')
setup-xorg-base $videodrivers xfce4 firefox slim
-
diff --git a/setup-xorg-base.in b/setup-xorg-base.in
index 5fb41b0..798bbad 100644
--- a/setup-xorg-base.in
+++ b/setup-xorg-base.in
@@ -26,4 +26,3 @@ if ! rc-service -q udev status; then
rc-service udev start
rc-service udev-postmount start
fi
-
diff --git a/uniso.c b/uniso.c
index b5e399d..2eb6e3c 100644
--- a/uniso.c
+++ b/uniso.c
@@ -432,7 +432,7 @@ static int link_or_clone(const char *src, const char *dst, size_t bytes)
}
static int uniso_read_file(struct uniso_context *ctx,
- struct uniso_reader *rd)
+ struct uniso_reader *rd)
{
struct uniso_dirent *dir = container_of(rd, struct uniso_dirent, reader);
int fd, rc;
@@ -555,9 +555,9 @@ static int queue_dirent(struct uniso_context *ctx, void *isode, const char *name
strcpy(dir->name, name);
return queue_reader(ctx, &dir->reader,
- ide->extent.endianess * ISOFS_BLOCK_SIZE,
- (ide->flags & ISOFS_DR_FLAG_DIRECTORY) ?
- uniso_read_directory : uniso_read_file);
+ ide->extent.endianess * ISOFS_BLOCK_SIZE,
+ (ide->flags & ISOFS_DR_FLAG_DIRECTORY) ?
+ uniso_read_directory : uniso_read_file);
}
static int uniso_read_volume_descriptor(struct uniso_context *ctx,
@@ -619,8 +619,8 @@ int uniso(int fd)
ctx->loglevel = 1;
queue_reader(ctx, &ctx->volume_desc_reader,
- 16 * ISOFS_BLOCK_SIZE,
- uniso_read_volume_descriptor);
+ 16 * ISOFS_BLOCK_SIZE,
+ uniso_read_volume_descriptor);
while (list_hashed(&ctx->parser_head)) {
rd = list_entry(ctx->parser_head.next, struct uniso_reader, parser_list);
diff --git a/update-conf.in b/update-conf.in
index f287dd9..61ea654 100644
--- a/update-conf.in
+++ b/update-conf.in
@@ -1,6 +1,5 @@
#!/bin/sh
-
PREFIX=
VERSION=@VERSION@
@@ -64,19 +63,19 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
unset choice
if [ "$lflag" ] ; then
-
+
# just list the file
if [ "$aflag" ] || is_modified "$f" ; then
echo "$p"
fi
-
+
elif [ "$aflag" ] || is_modified "$f" ; then
if [ "$iflag" ] && is_initd "$f" ; then
echo "Autoupdating $p"
mv "$apknew" "$p"
continue
fi
-
+
diff -u "$p" "$apknew"
# ask user what to do with the file
@@ -89,7 +88,7 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
n) continue;;
s) diff -u "$p" "$apknew" | ${PAGER:-less}
unset choice
- ;;
+ ;;
e) ${EDITOR:-vi} "$apknew" ; unset choice;;
v) if [ "$vflag" ]; then
vimdiff "$p" "$apknew"
@@ -106,4 +105,3 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
mv "$apknew" "$p"
fi
done
-
diff --git a/update-kernel.in b/update-kernel.in
index fc0899d..b529e35 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -27,14 +27,14 @@ TMPDIR=
features=
error() {
- echo "$SCRIPT: $1" >&2
+ echo "$SCRIPT: $1" >&2
}
usage() {
- [ "$2" ] && error "$2"
- local opts="[-F <feature>]... [-p <package>]..."
- local dest_args="[-a <arch>] <dest_dir>"
- cat >&2 <<EOF
+ [ "$2" ] && error "$2"
+ local opts="[-F <feature>]... [-p <package>]..."
+ local dest_args="[-a <arch>] <dest_dir>"
+ cat >&2 <<EOF
Syntax: $SCRIPT $opts [$dest_args]
$SCRIPT -f <flavor> $opts $dest_args
@@ -50,117 +50,117 @@ Options: -a|--arch <arch> Install kernel for specified architecture
--repositories-file <f> apk repositories file
EOF
- exit $1
+ exit $1
}
QUIET_OPT="--quiet"
OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose,hostkeys,repositories-file: \
- -n $SCRIPT -o a:b:f:F:hp:vK -- "$@") || usage 1
+ -n $SCRIPT -o a:b:f:F:hp:vK -- "$@") || usage 1
eval set -- "$OPTS"
while :; do
- case "$1" in
+ case "$1" in
-a|--arch)
- shift
- ARCH=$1
- ;;
+ shift
+ ARCH=$1
+ ;;
-b|--build-dir)
- shift
- BUILDDIR=$1
- ;;
+ shift
+ BUILDDIR=$1
+ ;;
-f|--flavor)
- shift
- FLAVOR=$1
- ;;
+ shift
+ FLAVOR=$1
+ ;;
-F|--feature)
- shift
- features="$features $1"
- ;;
+ shift
+ features="$features $1"
+ ;;
-h|--help)
- echo "$SCRIPT @VERSION@" >&2
- usage 0
- ;;
+ echo "$SCRIPT @VERSION@" >&2
+ usage 0
+ ;;
-p|--package)
- shift
- PACKAGES="$PACKAGES $1"
- ;;
+ shift
+ PACKAGES="$PACKAGES $1"
+ ;;
-v|--verbose)
- QUIET_OPT=
- ;;
+ QUIET_OPT=
+ ;;
-K|--hostkeys)
- MKINITFS_ARGS="$MKINITFS_ARGS -K"
- ;;
- --repositories-file)
- shift
- REPOSITORIES_FILE=$1
- ;;
+ MKINITFS_ARGS="$MKINITFS_ARGS -K"
+ ;;
+ --repositories-file)
+ shift
+ REPOSITORIES_FILE=$1
+ ;;
--)
- break
- ;;
- esac
- shift
+ break
+ ;;
+ esac
+ shift
done
DESTDIR=$2
[ "$BUILDDIR" -a "$FLAVOR" ] && \
- usage 1 "Cannot specify both build directory and flavor"
+ usage 1 "Cannot specify both build directory and flavor"
if [ -z "$DESTDIR" ]; then
- [ "$ARCH" ] && \
- usage 1 "Cannot specify architecture when updating the current kernel"
-
- [ "$FLAVOR" ] && \
- usage 1 "Cannot specify flavor when updating the current kernel"
-
- [ "$SUPERUSER" ] || \
- usage 1 "Specify destination directory or run as superuser"
-
- while read MOUNT; do
- set -- $MOUNT
- [ $2 = /.modloop ] || continue
- DESTDIR=$(dirname $(losetup $1 | cut -d " " -f 3))
- MNTDIR=$(dirname "$DESTDIR")
- break
- done < /proc/mounts
-
- if [ -z "$MNTDIR" ]; then
- error "Module loopback device not mounted"
- exit 1
- fi
+ [ "$ARCH" ] && \
+ usage 1 "Cannot specify architecture when updating the current kernel"
+
+ [ "$FLAVOR" ] && \
+ usage 1 "Cannot specify flavor when updating the current kernel"
+
+ [ "$SUPERUSER" ] || \
+ usage 1 "Specify destination directory or run as superuser"
+
+ while read MOUNT; do
+ set -- $MOUNT
+ [ $2 = /.modloop ] || continue
+ DESTDIR=$(dirname $(losetup $1 | cut -d " " -f 3))
+ MNTDIR=$(dirname "$DESTDIR")
+ break
+ done < /proc/mounts
+
+ if [ -z "$MNTDIR" ]; then
+ error "Module loopback device not mounted"
+ exit 1
+ fi
fi
remount() {
- mount $1 -o remount "$MNTDIR"
+ mount $1 -o remount "$MNTDIR"
}
ignore_sigs() {
- trap "" $SIGNALS
+ trap "" $SIGNALS
}
clean_up() {
- set +e
- ignore_sigs
+ set +e
+ ignore_sigs
- [ "$SUPERUSER" ] && apk del $QUIET_OPT $VIRTUAL
- rm -fr $TMPDIR
+ [ "$SUPERUSER" ] && apk del $QUIET_OPT $VIRTUAL
+ rm -fr $TMPDIR
}
trap clean_up EXIT $SIGNALS
if [ "$SUPERUSER" ]; then
- apk add $QUIET_OPT --update-cache -t $VIRTUAL mkinitfs squashfs-tools kmod
+ apk add $QUIET_OPT --update-cache -t $VIRTUAL mkinitfs squashfs-tools kmod
fi
if [ -z "$features" ]; then
- . /etc/mkinitfs/mkinitfs.conf
+ . /etc/mkinitfs/mkinitfs.conf
fi
if [ -z "$FLAVOR" ]; then
- FLAVOR=$(uname -r | cut -d - -f 3-)
- [ "$FLAVOR" ] || FLAVOR=vanilla
+ FLAVOR=$(uname -r | cut -d - -f 3-)
+ [ "$FLAVOR" ] || FLAVOR=vanilla
fi
[ "$ARCH" ] || ARCH=$(apk --print-arch)
@@ -171,56 +171,56 @@ BOOT=$ROOT/boot
WRAPPER=
_exec() {
- $WRAPPER "$@"
+ $WRAPPER "$@"
}
_apk() {
- local cmd=$1
- shift
-
- local wrapper=
- if [ -z "$SUPERUSER" ]; then
- local opt=
- local fake_env=$TMPDIR/fake-env
- if [ -f $fake_env ]; then
- opt="-i $fake_env"
- WRAPPER="fakeroot $opt --"
+ local cmd=$1
+ shift
+
+ local wrapper=
+ if [ -z "$SUPERUSER" ]; then
+ local opt=
+ local fake_env=$TMPDIR/fake-env
+ if [ -f $fake_env ]; then
+ opt="-i $fake_env"
+ WRAPPER="fakeroot $opt --"
+ fi
+ wrapper="fakeroot $opt -s $fake_env --"
fi
- wrapper="fakeroot $opt -s $fake_env --"
- fi
- $wrapper apk $cmd $QUIET_OPT -p $ROOT --arch "$ARCH" \
- --keys-dir /etc/apk/keys \
- --repositories-file "$REPOSITORIES_FILE" $*
+ $wrapper apk $cmd $QUIET_OPT -p $ROOT --arch "$ARCH" \
+ --keys-dir /etc/apk/keys \
+ --repositories-file "$REPOSITORIES_FILE" $*
}
extra_pkgs() {
- local res=$(_apk search -x $1)
- if [ "$res" ]; then
- echo $*
- fi
+ local res=$(_apk search -x $1)
+ if [ "$res" ]; then
+ echo $*
+ fi
}
# set up the root and get the APKINDEX for search
_apk add --initdb --update-cache
if [ "$BUILDDIR" ]; then
- case "$ARCH" in
- arm*|aarch64*) _install="zinstall dtbs_install" ;;
- *) _install="install" ;;
- esac
-
- mkdir -p $BOOT
- make -C "$BUILDDIR" $_install firmware_install modules_install \
- INSTALL_MOD_PATH=$ROOT \
- INSTALL_PATH=$BOOT \
- INSTALL_DTBS_PATH='$ROOT/usr/lib/linux-$(KERNELRELEASE)'
+ case "$ARCH" in
+ arm*|aarch64*) _install="zinstall dtbs_install" ;;
+ *) _install="install" ;;
+ esac
+
+ mkdir -p $BOOT
+ make -C "$BUILDDIR" $_install firmware_install modules_install \
+ INSTALL_MOD_PATH=$ROOT \
+ INSTALL_PATH=$BOOT \
+ INSTALL_DTBS_PATH='$ROOT/usr/lib/linux-$(KERNELRELEASE)'
else
- if [ -z "$PACKAGES" ]; then
- PACKAGES="$(extra_pkgs "dahdi-linux-$FLAVOR" dahdi-linux)
- $(extra_pkgs "xtables-addons-$FLAVOR")"
- fi
- PACKAGES="$PACKAGES linux-$FLAVOR linux-firmware"
+ if [ -z "$PACKAGES" ]; then
+ PACKAGES="$(extra_pkgs "dahdi-linux-$FLAVOR" dahdi-linux)
+ $(extra_pkgs "xtables-addons-$FLAVOR")"
+ fi
+ PACKAGES="$PACKAGES linux-$FLAVOR linux-firmware"
fi
_apk add --no-scripts alpine-base $PACKAGES
@@ -248,38 +248,38 @@ done
_exec mksquashfs $MODLOOP "$STAGING/$MODIMG" -comp xz
_exec mkinitfs $MKINITFS_ARGS -q -b $ROOT -F "$features base squashfs" \
- -o "$STAGING/initramfs-$FLAVOR" "$KVER"
+ -o "$STAGING/initramfs-$FLAVOR" "$KVER"
for file in System.map config vmlinuz; do
- cp "$BOOT/$file$KVER_FLAVOR" $STAGING
+ cp "$BOOT/$file$KVER_FLAVOR" $STAGING
done
if [ "$MNTDIR" ]; then
- ignore_sigs
- umount /.modloop
- remount -w
+ ignore_sigs
+ umount /.modloop
+ remount -w
fi
mv $STAGING/* "$DESTDIR"
if [ -d "$DTBDIR" ]; then
- _opwd=$PWD
- case "$FLAVOR" in
- rpi*) _dtb="$DESTDIR" ;;
- *) _dtb="$DESTDIR/dtbs" ;;
- esac
- mkdir -p "$_dtb"
- _dtb=$(realpath "$_dtb")
- cd "$DTBDIR"
- find -type f \( -name "*.dtb" -o -name "*.dtbo" \) | cpio -pudm "$_dtb" 2> /dev/null
- cd "$_opwd"
+ _opwd=$PWD
+ case "$FLAVOR" in
+ rpi*) _dtb="$DESTDIR" ;;
+ *) _dtb="$DESTDIR/dtbs" ;;
+ esac
+ mkdir -p "$_dtb"
+ _dtb=$(realpath "$_dtb")
+ cd "$DTBDIR"
+ find -type f \( -name "*.dtb" -o -name "*.dtbo" \) | cpio -pudm "$_dtb" 2> /dev/null
+ cd "$_opwd"
fi
if [ "$MNTDIR" ]; then
- set +e
- sync
- remount -r
- mount -o loop "$DESTDIR/$MODIMG" /.modloop
+ set +e
+ sync
+ remount -r
+ mount -o loop "$DESTDIR/$MODIMG" /.modloop
fi
exit 0