whitespace pedantry

This commit is contained in:
Bernhard Landauer 2018-04-14 00:07:43 +02:00
parent 52e415f11d
commit b6023bf92f
16 changed files with 69 additions and 69 deletions

View file

@ -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

View file

@ -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[*]}"

View file

@ -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

View file

@ -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[*]}"

View file

@ -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

View file

@ -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[*]}"

View file

@ -71,7 +71,7 @@ shift $(( OPTIND - 1 ))
check_root "$0" "${orig_argv[@]}"
if ${automount};then
if ${automount}; then
chrootdir=/mnt
run_args=/bin/bash

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
;;

View file

@ -95,7 +95,7 @@ die() {
}
import(){
if [[ -r $1 ]];then
if [[ -r $1 ]]; then
source $1
else
die "Could not import $1"

View file

@ -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

View file

@ -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 ..

View file

@ -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"