From 94ff111a92884eea165d4a94dac9d505534a6030 Mon Sep 17 00:00:00 2001 From: udeved Date: Thu, 7 Jan 2016 03:05:04 +0100 Subject: [PATCH] format; clean up --- bin/chroot-run.in | 16 ++++++++-------- data/iso.d/community.set | 1 + lib/util-iso.sh | 8 ++++---- lib/util.sh | 25 ++++--------------------- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/bin/chroot-run.in b/bin/chroot-run.in index 6a7b0ce..d650b94 100644 --- a/bin/chroot-run.in +++ b/bin/chroot-run.in @@ -97,28 +97,28 @@ copy_hostconf () { } chroot_extra_umount() { - chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B - chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B + chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B + chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B - for cache_dir in ${cache_dirs[@]:1}; do + for cache_dir in ${cache_dirs[@]:1}; do chroot_mount "$cache_dir" "$1${cache_dir}" -Br - done + done - if [[ -n ${mountargs_ro[@]} ]];then + if [[ -n ${mountargs_ro[@]} ]];then local IFS=',' for m in ${mountargs_ro[@]}; do chroot_mount "${m%%:*}" "$1${m##*:}" -Br done unset IFS - fi + fi - if [[ -n ${mountargs_rw[@]} ]];then + if [[ -n ${mountargs_rw[@]} ]];then local IFS=',' for m in ${mountargs_rw[@]}; do chroot_mount "${m%%:*}" "$1${m##*:}" -B done unset IFS - fi + fi } umask 0022 diff --git a/data/iso.d/community.set b/data/iso.d/community.set index 0dd5e82..acd9d6e 100644 --- a/data/iso.d/community.set +++ b/data/iso.d/community.set @@ -12,3 +12,4 @@ lxqt mate netbook pantheon +openbox diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 4fc6b58..8d871bb 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -21,7 +21,7 @@ squash_image_dir() { return 1 fi local timer=$(get_timer) path=${work_dir}/iso/${iso_name}/${arch} - local sq_img="${path}/$(basename ${1}).sqfs" + local sq_img="${path}/${1##*/}.sqfs" mkdir -p ${path} msg "Generating SquashFS image for '${1}'" if [[ -f "${sq_img}" ]]; then @@ -40,7 +40,7 @@ squash_image_dir() { [[ "${iso_compression}" != "xz" ]] && highcomp="" msg2 "Creating SquashFS image. This may take some time..." local used_kernel=$(echo ${kernel} | cut -c 6) - if [[ "$(basename "$1")" == "mhwd-image" && ${used_kernel} -ge "4" ]]; then + if [[ "${1##*/}" == "mhwd-image" && ${used_kernel} -ge "4" ]]; then mksquashfs "${1}" "${sq_img}" -noappend -comp lz4 || die "Exit ..." else mksquashfs "${1}" "${sq_img}" -noappend -comp ${iso_compression} ${highcomp} || die "Exit ..." @@ -83,8 +83,8 @@ make_iso() { touch "${work_dir}/iso/.miso" for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do if [[ "$d" != "${work_dir}/iso" ]] && \ - [[ "$(basename "$d")" != "iso" ]] && \ - [[ "$(basename "$d")" != "efiboot" ]] && \ + [[ "${d##*/}" != "iso" ]] && \ + [[ "${d##*/}" != "efiboot" ]] && \ [[ "$d" != "${work_dir}" ]]; then squash_image_dir "$d" fi diff --git a/lib/util.sh b/lib/util.sh index ed13210..01bc84b 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -100,17 +100,9 @@ prepare_dir(){ } version_gen(){ - local y=$(date +%Y) m=$(date +%m) - dist_release=${y:2}.$m -} - -version_gen2(){ - local y=$(date +%Y) m=$(date +%m) - case $month in - 01|04|07|10) dist_release=${y:2}.$m.1 ;; - 02|05|08|11) dist_release=${y:2}.$m.2 ;; - *) dist_release=${y:2}.$m ;; - esac + local y=$(date +%Y) m=$(date +%m) ver + ver=${y:2}.$m + echo $ver } init_common(){ @@ -142,8 +134,6 @@ init_buildpkg(){ sets_dir_pkg="${SYSCONFDIR}/pkg.d" - prepare_dir "${sets_dir_pkg}" - [[ -d ${USERCONFDIR}/pkg.d ]] && sets_dir_pkg=${USERCONFDIR}/pkg.d [[ -z ${buildset_pkg} ]] && buildset_pkg='default' @@ -156,8 +146,6 @@ init_buildiso(){ sets_dir_iso="${SYSCONFDIR}/iso.d" - prepare_dir "${sets_dir_iso}" - [[ -d ${USERCONFDIR}/iso.d ]] && sets_dir_iso=${USERCONFDIR}/iso.d [[ -z ${buildset_iso} ]] && buildset_iso='default' @@ -166,11 +154,7 @@ init_buildiso(){ ##### iso settings ##### - if [[ -z ${dist_release} ]];then -# source /etc/lsb-release -# dist_release=${DISTRIB_RELEASE} - version_gen - fi + [[ -z ${dist_release} ]] && dist_release=$(version_gen) if [[ -z ${dist_codename} ]];then source /etc/lsb-release @@ -181,7 +165,6 @@ init_buildiso(){ [[ -z ${dist_name} ]] && dist_name="Manjaro" -# [[ -z ${iso_name} ]] && iso_name="manjaro" iso_name=${dist_name,,} iso_label="${dist_branding}${dist_release//.}"