From dad36a9f92e5d61f5ab126b2d21b099e6f8a361a Mon Sep 17 00:00:00 2001 From: udeved Date: Wed, 7 Jun 2017 23:45:34 +0200 Subject: [PATCH] buildiso, check-yaml: remove config vars --- bin/buildiso.in | 6 +----- bin/check-yaml.in | 5 +---- lib/util-iso-chroot.sh | 16 +++++++++------- lib/util-iso.sh | 43 +++++++++--------------------------------- lib/util-msg.sh | 6 +++--- lib/util-profile.sh | 11 +++-------- lib/util-yaml.sh | 9 ++------- lib/util.sh | 4 ---- 8 files changed, 28 insertions(+), 72 deletions(-) diff --git a/bin/buildiso.in b/bin/buildiso.in index 91a95d9..f6a4d12 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -19,7 +19,6 @@ SYSCONFDIR='@sysconfdir@' import ${LIBDIR}/util.sh import ${LIBDIR}/util-iso.sh -import ${LIBDIR}/util-iso-mount.sh import ${LIBDIR}/util-profile.sh prepare_build(){ @@ -71,9 +70,6 @@ show_profile(){ msg2 "netinstall: %s" "${netinstall}" msg2 "chrootcfg: %s" "${chrootcfg}" ${netinstall} && msg2 "netgroups: %s" "$(get_yaml)" - msg2 "geoip: %s" "${geoip}" - - msg2 "efi_boot_loader: %s" "${efi_boot_loader}" msg2 "hostname: %s" "${hostname}" msg2 "username: %s" "${username}" @@ -130,7 +126,7 @@ load_user_info load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf" -load_run_dir "${profile_repo}" +load_run_dir clean_first=true pretend=false diff --git a/bin/check-yaml.in b/bin/check-yaml.in index b1bada3..376c41d 100644 --- a/bin/check-yaml.in +++ b/bin/check-yaml.in @@ -48,9 +48,6 @@ show_profile(){ msg2 "netinstall: %s" "${netinstall}" msg2 "chrootcfg: %s" "${chrootcfg}" ${netinstall} && msg2 "netgroups: %s" "$(get_yaml)" - msg2 "geoip: %s" "${geoip}" - - msg2 "efi_boot_loader: %s" "${efi_boot_loader}" msg2 "hostname: %s" "${hostname}" msg2 "username: %s" "${username}" @@ -99,7 +96,7 @@ load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR} # to force old way to have buildiso run in iso-profiles dir # run_dir=$(pwd) -load_run_dir "${profile_repo}" +load_run_dir calamares=false pretend=false diff --git a/lib/util-iso-chroot.sh b/lib/util-iso-chroot.sh index 1680ea2..c021a46 100644 --- a/lib/util-iso-chroot.sh +++ b/lib/util-iso-chroot.sh @@ -34,7 +34,7 @@ set_xdm(){ } configure_mhwd_drivers(){ - local path=$1${mhwd_repo}/ \ + local path=$1$2/ \ drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers info "Configuring mwwd db ..." if [ -z "$(ls $path | grep catalyst-utils 2> /dev/null)" ]; then @@ -91,9 +91,11 @@ configure_logind(){ } configure_journald(){ - msg2 "Configuring journald ..." local conf=$1/etc/systemd/journald.conf - sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf" + if [[ -e $conf ]];then + msg2 "Configuring journald ..." + sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf" + fi } configure_services(){ @@ -171,9 +173,9 @@ configure_system(){ } make_repo(){ - local dest="$1" + local dest="$1" repo="$2" cp ${DATADIR}/pacman-mhwd.conf $dest/opt - repo-add $dest${mhwd_repo}/mhwd.db.tar.gz $dest${mhwd_repo}/*pkg*z + repo-add $dest$repo/mhwd.db.tar.gz $dest$repo/*pkg*z } clean_iso_root(){ @@ -235,7 +237,7 @@ clean_up_image(){ copy_from_cache(){ local list="${tmp_dir}"/mhwd-cache.list - local mnt="$1"; shift + local mnt="$1" repo="$2"; shift chroot-run "$mnt" \ pacman -v -Syw --noconfirm "$@" || return 1 chroot-run "$mnt" \ @@ -244,7 +246,7 @@ copy_from_cache(){ sed -i "s/.*\///" "$list" msg2 "Copying mhwd package cache ..." - rsync -v --files-from="$list" /var/cache/pacman/pkg "$mnt${mhwd_repo}" + rsync -v --files-from="$list" /var/cache/pacman/pkg "$mnt$repo" } chroot_clean(){ diff --git a/lib/util-iso.sh b/lib/util-iso.sh index b5eb7a9..8a56956 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -13,6 +13,7 @@ import ${LIBDIR}/util-chroot.sh import ${LIBDIR}/util-iso-chroot.sh import ${LIBDIR}/util-iso-grub.sh import ${LIBDIR}/util-yaml.sh +import ${LIBDIR}/util-iso-mount.sh error_function() { if [[ -p $logpipe ]]; then @@ -70,30 +71,6 @@ trap_exit() { kill "-$sig" "$$" } -configure_thus(){ - local fs="$1" - msg2 "Configuring Thus ..." - source "$fs/etc/mkinitcpio.d/${kernel}.preset" - local conf="$fs/etc/thus.conf" - echo "[distribution]" > "$conf" - echo "DISTRIBUTION_NAME = \"${dist_name} Linux\"" >> "$conf" - echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf" - echo "SHORT_NAME = \"${dist_name}\"" >> "$conf" - echo "[install]" >> "$conf" - echo "LIVE_MEDIA_SOURCE = \"/run/miso/bootmnt/${os_id}/${target_arch}/rootfs.sfs\"" >> "$conf" - echo "LIVE_MEDIA_DESKTOP = \"/run/miso/bootmnt/${os_id}/${target_arch}/desktopfs.sfs\"" >> "$conf" - echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf" - echo "LIVE_USER_NAME = \"${username}\"" >> "$conf" - echo "KERNEL = \"${kernel}\"" >> "$conf" - echo "VMLINUZ = \"$(echo ${ALL_kver} | sed s'|/boot/||')\"" >> "$conf" - echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf" - echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf" - - if [[ -f $fs/usr/share/applications/thus.desktop && -f $fs/usr/bin/kdesu ]];then - sed -i -e 's|sudo|kdesu|g' $fs/usr/share/applications/thus.desktop - fi -} - configure_live_image(){ local fs="$1" msg "Configuring [livefs]" @@ -101,7 +78,6 @@ configure_live_image(){ configure_system "$fs" configure_services "$fs" configure_calamares "$fs" - [[ ${edition} == "sonar" ]] && configure_thus "$fs" write_live_session_conf "$fs" msg "Done configuring [livefs]" } @@ -342,13 +318,13 @@ make_image_live() { make_image_mhwd() { if [[ ! -e ${work_dir}/mhwdfs.lock ]]; then msg "Prepare [drivers repository] (mhwdfs)" - local mhwdfs="${work_dir}/mhwdfs" + local mhwdfs="${work_dir}/mhwdfs" mhwd_repo="/opt/pkg" prepare_dir "${mhwdfs}${mhwd_repo}" mount_fs "${mhwdfs}" "${work_dir}" "${desktop_list}" - copy_from_cache "${mhwdfs}" "${packages[@]}" + copy_from_cache "${mhwdfs}" "${mhwd_repo}" "${packages[@]}" if [[ -n "${packages_cleanup[@]}" ]]; then for pkg in ${packages_cleanup[@]}; do @@ -356,8 +332,8 @@ make_image_mhwd() { done fi - make_repo "${mhwdfs}" - configure_mhwd_drivers "${mhwdfs}" + make_repo "${mhwdfs}" "${mhwd_repo}" + configure_mhwd_drivers "${mhwdfs}" "${mhwd_repo}" umount_fs clean_up_image "${mhwdfs}" @@ -488,11 +464,10 @@ make_profile(){ if ${clean_first};then chroot_clean "${chroots_iso}/${profile}/${target_arch}" - local unused_arch='' - case ${target_arch} in - i686) unused_arch='x86_64' ;; - x86_64) unused_arch='i686' ;; - esac + local unused_arch='i686' + if [[ ${target_arch} == 'i686' ]];then + unused_arch='x86_64' ;; + fi if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then chroot_clean "${chroots_iso}/${profile}/${unused_arch}" fi diff --git a/lib/util-msg.sh b/lib/util-msg.sh index 415232f..d4bd1b8 100644 --- a/lib/util-msg.sh +++ b/lib/util-msg.sh @@ -116,9 +116,9 @@ die() { } import(){ - if [[ -r $1 ]];then - source $1 + if [[ -r "$1" ]];then + source "$1" else - die "Could not import $1" + die 'Could not import %s' "$1" fi } diff --git a/lib/util-profile.sh b/lib/util-profile.sh index 90c501c..404c6f9 100644 --- a/lib/util-profile.sh +++ b/lib/util-profile.sh @@ -20,8 +20,9 @@ write_repo_conf(){ } load_run_dir(){ - [[ -f ${MT_USERCONFDIR}/$1.conf ]] || write_repo_conf - [[ -r ${MT_USERCONFDIR}/$1.conf ]] && source ${MT_USERCONFDIR}/$1.conf + local gitrepo='iso-profiles' + [[ -f ${MT_USERCONFDIR}/$gitrepo.conf ]] || write_repo_conf + [[ -r ${MT_USERCONFDIR}/$gitrepo.conf ]] && source ${MT_USERCONFDIR}/$gitrepo.conf return 0 } @@ -42,8 +43,6 @@ load_profile(){ [[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true" - [[ -z ${efi_boot_loader} ]] && efi_boot_loader="grub" - [[ -z ${hostname} ]] && hostname="manjaro" [[ -z ${username} ]] && username="manjaro" @@ -82,8 +81,6 @@ load_profile(){ netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master" - [[ -z ${geoip} ]] && geoip='true' - [[ -z ${smb_workgroup} ]] && smb_workgroup='' basic='true' @@ -129,7 +126,6 @@ reset_profile(){ unset autologin unset multilib unset nonfree_mhwd - unset efi_boot_loader unset hostname unset username unset password @@ -140,7 +136,6 @@ reset_profile(){ unset login_shell unset netinstall unset chrootcfg - unset geoip unset extra unset root_list unset desktop_list diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index b51aac5..c95421d 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -44,7 +44,7 @@ get_preset(){ } write_bootloader_conf(){ - local conf="${modules_dir}/bootloader.conf" + local conf="${modules_dir}/bootloader.conf" efi_boot_loader='grub' msg2 "Writing %s ..." "${conf##*/}" source "$(get_preset)" echo '---' > "$conf" @@ -256,12 +256,7 @@ write_locale_conf(){ msg2 "Writing %s ..." "${conf##*/}" echo "---" > "$conf" echo "localeGenPath: /etc/locale.gen" >> "$conf" - if ${geoip};then - echo "geoipUrl: freegeoip.net" >> "$conf" - else - echo "region: Europe" >> "$conf" - echo "zone: London" >> "$conf" - fi + echo "geoipUrl: freegeoip.net" >> "$conf" } write_settings_conf(){ diff --git a/lib/util.sh b/lib/util.sh index fe075a8..a76ac81 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -199,8 +199,6 @@ init_buildiso(){ cache_dir_iso="${cache_dir}/iso" - profile_repo='iso-profiles' - ##### iso settings ##### [[ -z ${dist_release} ]] && dist_release=$(get_release) @@ -220,8 +218,6 @@ init_buildiso(){ [[ -z ${kernel} ]] && kernel="linux49" [[ -z ${gpgkey} ]] && gpgkey='' - - mhwd_repo="/opt/pkg" } init_deployiso(){