diff --git a/bin/basestrap.in b/bin/basestrap.in index 3c163dc..ca6f41d 100644 --- a/bin/basestrap.in +++ b/bin/basestrap.in @@ -99,11 +99,11 @@ fi # kill chroot process if needed (TODO: check if needed at all) kill_chroot_process "$newroot" -if ${copykeyring};then +if ${copykeyring}; then copy_keyring "$newroot" fi -if ${copymirrorlist};then +if ${copymirrorlist}; then copy_mirrorlist "$newroot" fi diff --git a/bin/buildiso.in b/bin/buildiso.in index 9cd5cad..f52a569 100644 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -22,7 +22,7 @@ import ${LIBDIR}/util.sh show_profile(){ prepare_profile "$1" msg2 "iso_file: %s" "${iso_file}" - if ${verbose};then + if ${verbose}; then msg2 "autologin: %s" "${autologin}" msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}" @@ -44,7 +44,7 @@ show_profile(){ msg2 "addgroups: %s" "${addgroups}" [[ -n ${smb_workgroup} ]] && msg2 "smb_workgroup: %s" "${smb_workgroup}" - if [[ ${initsys} == 'systemd' ]];then + if [[ ${initsys} == 'systemd' ]]; then msg2 "enable_systemd: %s" "${enable_systemd[*]}" msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}" [[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}" diff --git a/bin/buildpkg.in b/bin/buildpkg.in index 5fec96c..eb8223d 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -58,7 +58,7 @@ display_settings(){ msg "PATHS:" msg2 "pkg_dir: %s" "${pkg_dir}" - if ${clean_first};then + if ${clean_first}; then msg "PKG:" msg2 "base_packages: %s" "${base_packages[*]}" fi diff --git a/bin/check-yaml.in b/bin/check-yaml.in index b8ff096..6fcf24c 100644 --- a/bin/check-yaml.in +++ b/bin/check-yaml.in @@ -44,7 +44,7 @@ show_profile(){ msg2 "login_shell: %s" "${login_shell}" msg2 "addgroups: %s" "${addgroups}" - if [[ ${initsys} == 'systemd' ]];then + if [[ ${initsys} == 'systemd' ]]; then msg2 "enable_systemd: %s" "${enable_systemd[*]}" msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}" [[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}" diff --git a/bin/chroot-run.in b/bin/chroot-run.in index fff5bfa..1a8b27f 100644 --- a/bin/chroot-run.in +++ b/bin/chroot-run.in @@ -81,7 +81,7 @@ copy_hostconf () { [[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf" [[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$1/etc/pacman-mirrors.conf" - if [[ -n ${build_mirror} ]];then + if [[ -n ${build_mirror} ]]; then build_mirror=${build_mirror}'/$repo/$arch' if ${keep_mirrors}; then set_branch "$1" "$(get_branch $1)" @@ -103,7 +103,7 @@ chroot_extra_umount() { chroot_mount "$cache_dir" "$1${cache_dir}" -Br 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 @@ -111,7 +111,7 @@ chroot_extra_umount() { unset IFS 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 diff --git a/bin/deployiso.in b/bin/deployiso.in index 61ea2b6..100f3e7 100644 --- a/bin/deployiso.in +++ b/bin/deployiso.in @@ -44,7 +44,7 @@ display_settings(){ msg2 "verbose: %s" "${verbose}" msg2 "torrent: %s" "${torrent}" - if ${torrent};then + if ${torrent}; then msg2 "tracker_url: %s" "${tracker_url}" msg2 "piece_size: %s" "${piece_size}" msg2 "iso_mirrors: %s" "${iso_mirrors[*]}" diff --git a/bin/manjaro-chroot.in b/bin/manjaro-chroot.in index 8d88240..f2baaf2 100644 --- a/bin/manjaro-chroot.in +++ b/bin/manjaro-chroot.in @@ -71,7 +71,7 @@ shift $(( OPTIND - 1 )) check_root "$0" "${orig_argv[@]}" -if ${automount};then +if ${automount}; then chrootdir=/mnt run_args=/bin/bash diff --git a/bin/mkchroot.in b/bin/mkchroot.in index e3678d9..ca27178 100644 --- a/bin/mkchroot.in +++ b/bin/mkchroot.in @@ -107,7 +107,7 @@ fi echo "$version" > "$working_dir/.manjaro-tools" -if ${build_locales};then +if ${build_locales}; then info "Using build locales ..." mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak" mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak" diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 7d07de2..635c628 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -10,9 +10,9 @@ # GNU General Public License for more details. copy_overlay(){ - if [[ -e $1 ]];then + if [[ -e $1 ]]; then msg2 "Copying [%s] ..." "${1##*/}" - if [[ -L $1 ]];then + if [[ -L $1 ]]; then cp -a --no-preserve=ownership $1/* $2 else cp -LR $1/* $2 @@ -21,7 +21,7 @@ copy_overlay(){ } add_svc_rc(){ - if [[ -f $1/etc/init.d/$2 ]];then + if [[ -f $1/etc/init.d/$2 ]]; then msg2 "Setting %s ..." "$2" chroot $1 rc-update add $2 default &>/dev/null fi @@ -29,14 +29,14 @@ add_svc_rc(){ add_svc_sd(){ if [[ -f $1/etc/systemd/system/$2.service ]] || \ - [[ -f $1/usr/lib/systemd/system/$2.service ]];then + [[ -f $1/usr/lib/systemd/system/$2.service ]]; then msg2 "Setting %s ..." "$2" chroot $1 systemctl enable $2 &>/dev/null fi } set_xdm(){ - if [[ -f $1/etc/conf.d/xdm ]];then + if [[ -f $1/etc/conf.d/xdm ]]; then local conf='DISPLAYMANAGER="'${displaymanager}'"' sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm fi @@ -148,7 +148,7 @@ write_live_session_conf(){ echo '' >> ${conf} echo '# live group membership' >> ${conf} echo "addgroups='${addgroups}'" >> ${conf} - if [[ -n ${smb_workgroup} ]];then + if [[ -n ${smb_workgroup} ]]; then echo '' >> ${conf} echo '# samba workgroup' >> ${conf} echo "smb_workgroup=${smb_workgroup}" >> ${conf} @@ -199,7 +199,7 @@ configure_thus(){ echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf" echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf" - if [[ -f $1/usr/share/applications/thus.desktop && -f $1/usr/bin/kdesu ]];then + if [[ -f $1/usr/share/applications/thus.desktop && -f $1/usr/bin/kdesu ]]; then sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/thus.desktop fi } @@ -256,7 +256,7 @@ chroot_clean(){ for image in "$1"/*fs; do [[ -d ${image} ]] || continue local name=${image##*/} - if [[ $name != "mhwdfs" ]];then + if [[ $name != "mhwdfs" ]]; then msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}" lock 9 "${image}.lock" "Locking chroot '${image}'" if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then @@ -273,20 +273,20 @@ clean_up_image(){ msg2 "Cleaning [%s]" "${1##*/}" local path - if [[ ${1##*/} == 'mhwdfs' ]];then + if [[ ${1##*/} == 'mhwdfs' ]]; then path=$1/var - if [[ -d $path/lib/mhwd ]];then + if [[ -d $path/lib/mhwd ]]; then mv $path/lib/mhwd $1 &> /dev/null fi - if [[ -d $path ]];then + if [[ -d $path ]]; then find "$path" -mindepth 0 -delete &> /dev/null fi - if [[ -d $1/mhwd ]];then + if [[ -d $1/mhwd ]]; then mkdir -p $path/lib mv $1/mhwd $path/lib &> /dev/null fi path=$1/etc - if [[ -d $path ]];then + if [[ -d $path ]]; then find "$path" -mindepth 0 -delete &> /dev/null fi else @@ -297,7 +297,7 @@ clean_up_image(){ find "$path" -name 'initramfs*.img' -delete &> /dev/null fi path=$1/var/lib/pacman/sync - if [[ -d $path ]];then + if [[ -d $path ]]; then find "$path" -type f -delete &> /dev/null fi path=$1/var/cache/pacman/pkg @@ -309,11 +309,11 @@ clean_up_image(){ find "$path" -type f -delete &> /dev/null fi path=$1/var/tmp - if [[ -d $path ]];then + if [[ -d $path ]]; then find "$path" -mindepth 1 -delete &> /dev/null fi path=$1/tmp - if [[ -d $path ]];then + if [[ -d $path ]]; then find "$path" -mindepth 1 -delete &> /dev/null fi fi diff --git a/lib/util-iso-mount.sh b/lib/util-iso-mount.sh index 0cce750..910334c 100644 --- a/lib/util-iso-mount.sh +++ b/lib/util-iso-mount.sh @@ -21,7 +21,7 @@ mount_img() { } umount_img() { - if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then + if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]]; then info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}" umount "${IMG_ACTIVE_MOUNTS[@]}" unset IMG_ACTIVE_MOUNTS @@ -60,7 +60,7 @@ mount_fs_net(){ } umount_fs(){ - if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then + if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]]; then info "overlayfs umount: [%s]" "${FS_ACTIVE_MOUNTS[@]}" umount "${FS_ACTIVE_MOUNTS[@]}" unset FS_ACTIVE_MOUNTS diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 7d23b4d..454de40 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -49,7 +49,7 @@ run_safe() { restoretrap=$(trap -p ERR) trap 'error_function $func' ERR - if ${verbose};then + if ${verbose}; then run_log "$func" else "$func" @@ -110,7 +110,7 @@ make_sfs() { fi fi - if ${persist};then + if ${persist}; then local size=32G local mnt="${mnt_dir}/${name}" msg2 "Creating ext4 image of %s ..." "${size}" @@ -129,7 +129,7 @@ make_sfs() { msg2 "Creating SquashFS image, this may take some time..." local used_kernel=${kernel:5:1} mksfs_args=() - if ${persist};then + if ${persist}; then mksfs_args+=(${work_dir}/${name}.img) else mksfs_args+=(${src}) @@ -144,7 +144,7 @@ make_sfs() { else mksfs_args+=(-comp ${comp} ${highcomp}) fi - if ${verbose};then + if ${verbose}; then mksquashfs "${mksfs_args[@]}" >/dev/null else mksquashfs "${mksfs_args[@]}" @@ -152,7 +152,7 @@ make_sfs() { make_checksum "${dest}" "${name}" ${persist} && rm "${src}.img" - if [[ -n ${gpgkey} ]];then + if [[ -n ${gpgkey} ]]; then make_sig "${dest}" "${name}" fi @@ -216,7 +216,7 @@ make_iso() { gen_iso_fn(){ local vars=() name vars+=("${iso_name}") - if ! ${chrootcfg};then + if ! ${chrootcfg}; then [[ -n ${profile} ]] && vars+=("${profile}") fi [[ ${initsys} == 'openrc' ]] && vars+=("${initsys}") @@ -413,20 +413,20 @@ make_grub(){ check_requirements(){ [[ -f ${run_dir}/repo_info ]] || die "%s is not a valid iso profiles directory!" "${run_dir}" - if ! $(is_valid_arch_iso ${target_arch});then + if ! $(is_valid_arch_iso ${target_arch}); then die "%s is not a valid arch!" "${target_arch}" fi - if ! $(is_valid_branch ${target_branch});then + if ! $(is_valid_branch ${target_branch}); then die "%s is not a valid branch!" "${target_branch}" fi - if ! is_valid_init "${initsys}";then + if ! is_valid_init "${initsys}"; then die "%s is not a valid init system!" "${initsys}" fi local iso_kernel=${kernel:5:1} host_kernel=$(uname -r) if [[ ${iso_kernel} < "4" ]] \ - || [[ ${host_kernel%%*.} < "4" ]];then + || [[ ${host_kernel%%*.} < "4" ]]; then die "The host and iso kernels must be version>=4.0!" fi } @@ -471,7 +471,7 @@ archive_logs(){ make_profile(){ msg "Start building [%s]" "${profile}" - if ${clean_first};then + if ${clean_first}; then chroot_clean "${chroots_iso}/${profile}/${target_arch}" local unused_arch='' @@ -479,7 +479,7 @@ make_profile(){ i686) unused_arch='x86_64' ;; x86_64) unused_arch='i686' ;; esac - if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then + if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]]; then chroot_clean "${chroots_iso}/${profile}/${unused_arch}" fi clean_iso_root "${iso_root}" @@ -509,7 +509,7 @@ make_profile(){ get_pacman_conf(){ local user_conf=${profile_dir}/user-repos.conf pac_arch='default' conf [[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib' - if [[ -f ${user_conf} ]];then + if [[ -f ${user_conf} ]]; then info "detected: %s" "user-repos.conf" check_user_repos_conf "${user_conf}" conf=${tmp_dir}/custom-pacman.conf diff --git a/lib/util-mount.sh b/lib/util-mount.sh index 82ba164..5dac52f 100644 --- a/lib/util-mount.sh +++ b/lib/util-mount.sh @@ -46,7 +46,7 @@ chroot_part_mount() { select_os(){ local os_list=( $(detect) ) count=${#os_list[@]} - if [[ ${count} > 1 ]];then + if [[ ${count} > 1 ]]; then msg "Detected systems:" local i=0 for os in ${os_list[@]};do @@ -66,7 +66,7 @@ select_os(){ type=$os_str root=${os_str%%:*} type=${type##*:} - if [[ "${type##*:}" == 'linux' ]];then + if [[ "${type##*:}" == 'linux' ]]; then msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$root" chroot_mount_partitions "$1" "$root" else @@ -99,7 +99,7 @@ chroot_mount_partitions(){ [[ ${chroot_arch} == x86-64 ]] && chroot_arch=${chroot_arch/-/_} case ${target_arch} in i686) - if [[ ${chroot_arch} == x86_64 ]];then + if [[ ${chroot_arch} == x86_64 ]]; then die "You can't chroot from %s host into %s!" "${target_arch}" "${chroot_arch}" fi ;; diff --git a/lib/util-msg.sh b/lib/util-msg.sh index 25a5bd8..fcdb44e 100644 --- a/lib/util-msg.sh +++ b/lib/util-msg.sh @@ -95,7 +95,7 @@ die() { } import(){ - if [[ -r $1 ]];then + if [[ -r $1 ]]; then source $1 else die "Could not import $1" diff --git a/lib/util-pkg-chroot.sh b/lib/util-pkg-chroot.sh index 6779e2b..dd2807e 100644 --- a/lib/util-pkg-chroot.sh +++ b/lib/util-pkg-chroot.sh @@ -38,13 +38,13 @@ get_makepkg_conf(){ # $1: target_arch prepare_conf(){ - if ! is_valid_arch_pkg "$1";then + if ! is_valid_arch_pkg "$1"; then die "%s is not a valid arch!" "$1" fi local pac_arch='default' - if [[ "$1" == 'multilib' ]];then + if [[ "$1" == 'multilib' ]]; then pac_arch='multilib' is_multilib=true fi @@ -94,10 +94,10 @@ load_group(){ } init_base_devel(){ - if ${udev_root};then + if ${udev_root}; then base_packages=( "$(load_group)" ) else - if ${is_multilib};then + if ${is_multilib}; then base_packages=('base-devel' 'multilib-devel') else base_packages=('base-devel') @@ -143,7 +143,7 @@ clean_up(){ msg "Cleaning up ..." msg2 "Cleaning [%s]" "${pkg_dir}" find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null - if [[ -z $SRCDEST ]];then + if [[ -z $SRCDEST ]]; then msg2 "Cleaning [source files]" find $PWD -maxdepth 1 -name '*.?z?' -delete #&> /dev/null fi @@ -168,7 +168,7 @@ archive_logs(){ local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list target='.' ver=$(get_full_version "$name") archive="${name}-${ver}-${target_arch}" - if [[ -n $LOGDEST ]];then + if [[ -n $LOGDEST ]]; then target=$LOGDEST find $target -maxdepth 1 -name "$archive*.log" -printf "%f\n" > $src else diff --git a/lib/util-pkgtree.sh b/lib/util-pkgtree.sh index 52e57f3..20e1041 100644 --- a/lib/util-pkgtree.sh +++ b/lib/util-pkgtree.sh @@ -38,7 +38,7 @@ clone_tree(){ sync_tree_manjaro(){ cd ${tree_dir} for repo in ${repo_tree[@]};do - if [[ -d packages-${repo} ]];then + if [[ -d packages-${repo} ]]; then cd packages-${repo} sync_tree "${repo}" cd .. @@ -53,7 +53,7 @@ sync_tree_abs(){ local repo_tree_abs=('packages' 'community') cd ${tree_dir_abs} for repo in ${repo_tree_abs[@]};do - if [[ -d ${repo} ]];then + if [[ -d ${repo} ]]; then cd ${repo} sync_tree "${repo}" cd .. diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index 2e038a0..9653f2d 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -72,7 +72,7 @@ write_servicescfg_conf(){ echo " - name: $s" >> "$conf" echo ' runlevel: default' >> "$conf" done - if [[ -n ${disable_openrc[@]} ]];then + if [[ -n ${disable_openrc[@]} ]]; then echo ' disabled:' >> "$conf" for s in ${disable_openrc[@]};do echo " - name: $s" >> "$conf" @@ -192,7 +192,7 @@ write_welcome_conf(){ echo " - storage" >> "$conf" echo " - ram" >> "$conf" echo " - root" >> "$conf" - if ${netinstall};then + if ${netinstall}; then echo " - internet" >> "$conf" fi } @@ -231,7 +231,7 @@ write_postcfg_conf(){ echo "keyrings:" >> "$conf" echo " - archlinux" >> "$conf" echo " - manjaro" >> "$conf" - if [[ -n ${smb_workgroup} ]];then + if [[ -n ${smb_workgroup} ]]; then echo "" >> "$conf" echo "samba:" >> "$conf" echo " - workgroup: ${smb_workgroup}" >> "$conf" @@ -240,7 +240,7 @@ write_postcfg_conf(){ get_yaml(){ local args=() yaml - if ${chrootcfg};then + if ${chrootcfg}; then args+=("${profile}/chrootcfg") else args+=("${profile}/packages") @@ -264,7 +264,7 @@ write_locale_conf(){ msg2 "Writing %s ..." "${conf##*/}" echo "---" > "$conf" echo "localeGenPath: /etc/locale.gen" >> "$conf" - if ${geoip};then + if ${geoip}; then echo "geoipUrl: https://geoip.tools/v1" >> "$conf" echo "geoipStyle: legacy" >> "$conf" else @@ -282,26 +282,26 @@ write_settings_conf(){ echo "sequence:" >> "$conf" echo " - show:" >> "$conf" echo " - welcome" >> "$conf" && write_welcome_conf - if ${oem_used};then + if ${oem_used}; then msg2 "Skipping to show locale and keyboard modules." else echo " - locale" >> "$conf" && write_locale_conf echo " - keyboard" >> "$conf" fi echo " - partition" >> "$conf" - if ${oem_used};then + if ${oem_used}; then msg2 "Skipping to show users module." else echo " - users" >> "$conf" && write_users_conf fi - if ${netinstall};then + if ${netinstall}; then echo " - netinstall" >> "$conf" && write_netinstall_conf fi echo " - summary" >> "$conf" echo " - exec:" >> "$conf" echo " - partition" >> "$conf" echo " - mount" >> "$conf" - if ${netinstall};then + if ${netinstall}; then if ${chrootcfg}; then echo " - chrootcfg" >> "$conf" echo " - networkcfg" >> "$conf" @@ -316,7 +316,7 @@ write_settings_conf(){ fi echo " - machineid" >> "$conf" && write_machineid_conf echo " - fstab" >> "$conf" - if ${oem_used};then + if ${oem_used}; then msg2 "Skipping to set locale, keyboard and localecfg modules." else echo " - locale" >> "$conf" @@ -327,14 +327,14 @@ write_settings_conf(){ echo " - luksbootkeyfile" >> "$conf" echo " - initcpiocfg" >> "$conf" echo " - initcpio" >> "$conf" && write_initcpio_conf - if ${oem_used};then + if ${oem_used}; then msg2 "Skipping to set users module." echo " - oemuser" >> "$conf" else echo " - users" >> "$conf" fi echo " - displaymanager" >> "$conf" && write_displaymanager_conf - if ${mhwd_used};then + if ${mhwd_used}; then echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf else msg2 "Skipping to set mhwdcfg module." @@ -346,7 +346,7 @@ write_settings_conf(){ esac echo " - grubcfg" >> "$conf" echo " - bootloader" >> "$conf" && write_bootloader_conf - if ${oem_used};then + if ${oem_used}; then msg2 "Skipping to set postcfg module." else echo " - postcfg" >> "$conf" && write_postcfg_conf @@ -357,7 +357,7 @@ write_settings_conf(){ echo '' >> "$conf" echo "branding: ${iso_name}" >> "$conf" echo '' >> "$conf" - if ${oem_used};then + if ${oem_used}; then echo "prompt-install: false" >> "$conf" else echo "prompt-install: true" >> "$conf"