summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xadelie-build-cd50
1 files changed, 27 insertions, 23 deletions
diff --git a/adelie-build-cd b/adelie-build-cd
index 5c48f3d..4a9fe3d 100755
--- a/adelie-build-cd
+++ b/adelie-build-cd
@@ -2,7 +2,7 @@
def_arch=$(uname -m)
def_ver="1.0-rc1"
-declare -r PROGNAME=$(basename $0)
+readonly PROGNAME=$(basename $0)
warn() {
@@ -75,29 +75,29 @@ while [ -n "$1" ]; do
case $1 in
-a | --arch)
shift
- declare -r MY_ARCH=$1
+ readonly MY_ARCH=$1
;;
-h | --help)
usage
exit
;;
-f | --full)
- declare -r DO_FULL=full
+ readonly DO_FULL=full
;;
-k | --kind)
shift
- declare -r MY_KIND=$1
+ readonly MY_KIND=$1
;;
-p | --phase)
shift
- declare -r MY_PHASE=$1
+ readonly MY_PHASE=$1
;;
-s | --sign)
- declare -r SIGN=yes
+ readonly SIGN=yes
;;
-v | --version)
shift
- declare -r MY_VER=$1
+ readonly MY_VER=$1
;;
*)
usage >&2
@@ -108,13 +108,13 @@ while [ -n "$1" ]; do
done
set -a
-declare -r ARCH=${MY_ARCH:-$def_arch}
-declare -r KIND=${MY_KIND:-live}
-declare -r LDARCH=${LDARCH:-$ARCH}
-declare -r PHASE=${MY_PHASE:-all}
-declare -r VERSION=${MY_VER:-$def_ver}
-declare -r APKVER=${MY_APKVER:-$VERSION}
-declare -r URL=${MY_URL:-https://distfiles.adelielinux.org/adelie/$APKVER/}
+readonly ARCH=${MY_ARCH:-$def_arch}
+readonly KIND=${MY_KIND:-live}
+readonly LDARCH=${LDARCH:-$ARCH}
+readonly PHASE=${MY_PHASE:-all}
+readonly VERSION=${MY_VER:-$def_ver}
+readonly APKVER=${MY_APKVER:-$VERSION}
+readonly URL=${MY_URL:-https://distfiles.adelielinux.org/adelie/$APKVER/}
set +a
ensure_commands
@@ -144,9 +144,9 @@ clean_dirs() {
install_pkgs() {
header "Installing base system to squash root..."
- declare -r PACKAGES=$(cat packages/base 2>/dev/null || fatal 'No core packages specified')
- declare -r ARCH_PKGS=$(cat packages/arch/$ARCH 2>/dev/null || echo '')
- declare -r KIND_PKGS=$(cat packages/kind/$KIND 2>/dev/null || echo '')
+ readonly PACKAGES=$(cat packages/base 2>/dev/null || fatal 'No core packages specified')
+ readonly ARCH_PKGS=$(cat packages/arch/$ARCH 2>/dev/null || echo '')
+ readonly KIND_PKGS=$(cat packages/kind/$KIND 2>/dev/null || echo '')
mkdir -p squashroot-$ARCH/etc/apk/keys
cp 'packages@adelielinux.org.pub' squashroot-$ARCH/etc/apk/keys/
@@ -167,7 +167,9 @@ make_structure() {
chown 1000:1000 squashroot-$ARCH/home/live/.zshrc
mkdir squashroot-$ARCH/target
mkdir -p squashroot-$ARCH/media/live
- mkdir -p squashroot-$ARCH/etc/runlevels/{sysinit,boot,default,shutdown}
+ for _runlevel in sysinit boot default shutdown; do
+ mkdir -p squashroot-$ARCH/etc/runlevels/$_runlevel
+ done
echo 'adelie-live' > squashroot-$ARCH/etc/hostname
echo 'mtab_is_file=no' > squashroot-$ARCH/etc/conf.d/mtab
@@ -233,7 +235,7 @@ make_structure() {
-X "$URL/system/$EXTRA_MIRROR" \
-X "$URL/user/$EXTRA_MIRROR" \
--root squashroot-$ARCH add docs
- declare -r PACKAGES_DIR=squashroot-$ARCH/packages/$ARCH
+ readonly PACKAGES_DIR=squashroot-$ARCH/packages/$ARCH
mkdir -p $PACKAGES_DIR
# Fetch all APKs.
apk --arch $ARCH \
@@ -263,8 +265,10 @@ make_initrd() {
# mount points
mkdir initrd-$ARCH/dev
mkdir initrd-$ARCH/media
- mkdir initrd-$ARCH/{newroot,lowerroot,upperroot}
- chmod 755 initrd-$ARCH/{newroot,lowerroot,upperroot}
+ for _rootdir in newroot lowerroot upperroot; do
+ mkdir initrd-$ARCH/$_rootdir
+ chmod 755 initrd-$ARCH/$_rootdir
+ done
mkdir initrd-$ARCH/proc
mkdir initrd-$ARCH/sys
@@ -322,10 +326,10 @@ prepare_cdroot() {
}
create_iso() {
- local CD_VERSION="$VERSION"
+ CD_VERSION="$VERSION"
header 'Creating the CD...'
- declare -r CD_PARAMS=$(cat iso-params-$ARCH)
+ readonly CD_PARAMS=$(cat iso-params-$ARCH)
CD_VERSION=$(echo $CD_VERSION | sed s/-alpha/a/)
CD_VERSION=$(echo $CD_VERSION | sed s/-beta/b/)
CD_VERSION=$(echo $CD_VERSION | sed s/-rc/rc/)