From 4ee86e383afa27e63f2784cdf17e0bb8de7d0d9d Mon Sep 17 00:00:00 2001 From: udeved Date: Mon, 24 Oct 2016 16:56:42 +0200 Subject: [PATCH 01/18] buildiso: prepare to reimplement sigining --- bin/buildiso.in | 4 ---- lib/util-iso-boot.sh | 12 ++++------- lib/util-iso.sh | 51 +++++++++++++++++++++++++++++++++----------- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/bin/buildiso.in b/bin/buildiso.in index cb1564c..55e2de2 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -90,7 +90,6 @@ display_settings(){ msg2 "images_only: %s" "${images_only}" msg2 "iso_only: %s" "${iso_only}" msg2 "persist: %s" "${persist}" -# msg2 "sign: %s" "${sign}" msg2 "torrent: %s" "${torrent}" msg "DIST SETTINGS:" @@ -123,7 +122,6 @@ pretend=false images_only=false iso_only=false verbose=false -# sign=false torrent=false persist=false @@ -141,7 +139,6 @@ usage() { echo ' -i Init system to use' echo " [default: ${initsys}]" echo ' -m Set SquashFS image mode to persistence' -# echo ' -s Sign the sfs images' echo ' -c Disable clean work dir' echo ' -x Build images only' echo ' -z Generate iso only' @@ -168,7 +165,6 @@ while getopts "${opts}" arg; do t) cache_dir_iso="$OPTARG" ;; k) kernel="$OPTARG" ;; i) initsys="$OPTARG" ;; -# s) sign=true ;; c) clean_first=false ;; x) images_only=true ;; z) iso_only=true ;; diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index 797ecc8..c6d2b31 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -42,21 +42,17 @@ prepare_initcpio(){ sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown } -gen_boot_initramfs(){ +prepare_initramfs(){ cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf" -} - -# $1: work_dir -gen_boot_image(){ - local _kernver=$(cat $1/usr/lib/modules/*/version) - chroot-run $1 \ + local _kernver=$(cat $2/usr/lib/modules/*/version) + chroot-run $2 \ /usr/bin/mkinitcpio -k ${_kernver} \ -c /etc/mkinitcpio-${iso_name}.conf \ -g /boot/initramfs.img } -copy_boot_extra(){ +prepare_boot_extras(){ cp $1/boot/intel-ucode.img $2/intel_ucode.img cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE cp $1/boot/memtest86+/memtest.bin $2/memtest diff --git a/lib/util-iso.sh b/lib/util-iso.sh index c968437..6e49fca 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -97,8 +97,11 @@ prepare_ext4_img(){ umount_img "${mnt}" } -sign_iso(){ - su ${OWNER} -c "signfile ${iso_dir}/$1" +make_sig () { + msg2 "Creating signature file..." + cd "$1" + gpg --detach-sign --default-key ${gpg_key} $2.sfs + cd ${OLDPWD} } # $1: file @@ -358,12 +361,20 @@ make_image_boot() { mount_image_live "${path}" configure_plymouth "${path}" - gen_boot_initramfs "${profile_dir}" "${path}" +# if [[ ${gpg_key} ]]; then +# gpg --export ${gpg_key} >${work_dir}/gpgkey +# exec 17<>${work_dir}/gpgkey +# fi +# MISO_GNUPG_FD=${gpg_key:+17} - gen_boot_image "${path}" + prepare_initramfs "${profile_dir}" "${path}" + +# if [[ ${gpg_key} ]]; then +# exec 17<&- +# fi mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img - copy_boot_extra "${path}" "${boot}" + prepare_boot_extras "${path}" "${boot}" umount_image @@ -482,6 +493,18 @@ compress_images(){ show_elapsed_time "${FUNCNAME}" "${timer}" } +prepare_boot_loaders(){ + local timer=$(get_timer) + run_safe "make_image_boot" + run_safe "make_isolinux" + run_safe "make_syslinux" + if [[ "${target_arch}" == "x86_64" ]]; then + run_safe "make_efi_usb" + run_safe "make_efi_dvd" + fi + show_elapsed_time "${FUNCNAME}" "${timer}" +} + prepare_images(){ local timer=$(get_timer) load_pkgs "${profile_dir}/Packages-Root" @@ -498,13 +521,13 @@ prepare_images(){ load_pkgs "${packages_mhwd}" run_safe "make_image_mhwd" fi - run_safe "make_image_boot" - run_safe "make_isolinux" - run_safe "make_syslinux" - if [[ "${target_arch}" == "x86_64" ]]; then - run_safe "make_efi_usb" - run_safe "make_efi_dvd" - fi +# run_safe "make_image_boot" +# run_safe "make_isolinux" +# run_safe "make_syslinux" +# if [[ "${target_arch}" == "x86_64" ]]; then +# run_safe "make_efi_usb" +# run_safe "make_efi_dvd" +# fi show_elapsed_time "${FUNCNAME}" "${timer}" } @@ -526,6 +549,10 @@ make_profile(){ ${verbose} && archive_logs exit 1 fi + if ${boot_only}; then + prepare_boot_loaders + exit 1 + fi if ${images_only}; then prepare_images ${verbose} && archive_logs From 9629f5416c58ed1627df11025de8cb7eac0c5a1d Mon Sep 17 00:00:00 2001 From: udeved Date: Mon, 24 Oct 2016 18:04:09 +0200 Subject: [PATCH 02/18] util-iso*: clean up code, comment non working code for now --- lib/util-iso-image.sh | 12 +++++ lib/util-iso.sh | 119 +++++++++++++++++------------------------- 2 files changed, 61 insertions(+), 70 deletions(-) diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 324f6c8..07b2b16 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -20,6 +20,18 @@ copy_overlay(){ fi } +mount_img() { + mkdir -p "$2" + info "mount: [%s]" "$1" + mount "$1" "$2" +} + +umount_img() { + info "umount: [%s]" "$1" + umount -d "$1" + rm -r "$1" +} + configure_plymouth(){ if ${plymouth_boot};then msg2 "Configuring plymouth: %s" "${plymouth_theme}" diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 6e49fca..c9b8285 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -67,36 +67,6 @@ trap_exit() { kill "-$sig" "$$" } -mount_img() { - mkdir -p "$2" - info "mount: [%s]" "$1" - mount "$1" "$2" -} - -umount_img() { - info "umount: [%s]" "$1" - umount -d "$1" - rm -r "$1" -} - -prepare_ext4_img(){ - local size=32G - local src="$1" - local name=${src##*/} - local mnt="${mnt_dir}/${name}" - msg2 "Creating ext4 image of %s ..." "${size}" - truncate -s ${size} "${src}.img" - local ext4_args=() - ${verbose} && ext4_args+=(-q) - ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0) - mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null - tune2fs -c 0 -i 0 "${src}.img" &> /dev/null - mount_img "${work_dir}/${name}.img" "${mnt}" - msg2 "Copying %s ..." "${src}/" - cp -aT "${src}/" "${mnt}/" - umount_img "${mnt}" -} - make_sig () { msg2 "Creating signature file..." cd "$1" @@ -137,7 +107,22 @@ make_sfs() { fi fi - ${persist} && prepare_ext4_img "${src}" + if ${persist};then + local size=32G + local mnt="${mnt_dir}/${name}" + msg2 "Creating ext4 image of %s ..." "${size}" + truncate -s ${size} "${src}.img" + local ext4_args=() + ${verbose} && ext4_args+=(-q) + ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0) + mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null + tune2fs -c 0 -i 0 "${src}.img" &> /dev/null + mount_img "${work_dir}/${name}.img" "${mnt}" + msg2 "Copying %s ..." "${src}/" + cp -aT "${src}/" "${mnt}/" + umount_img "${mnt}" + + fi msg2 "Creating SquashFS image, this may take some time..." local used_kernel=${kernel:5:1} mksfs_args=() @@ -394,22 +379,6 @@ make_efi_usb() { fi } -prepare_fat_img(){ - local size=31M - local src="$1" - local mnt="${mnt_dir}/efiboot" - local img="${src}/efiboot.img" - ${pxe_boot} && size=40M - msg2 "Creating fat image of %s ..." "${size}" - truncate -s ${size} "${img}" - mkfs.fat -n MISO_EFI "${img}" &>/dev/null - mkdir -p "${mnt}" - mount_img "${img}" "${mnt}" - prepare_efiboot_image "${mnt}" "${iso_root}" - prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd" - umount_img "${mnt}" -} - # Prepare kernel.img::/EFI for "El Torito" EFI boot mode make_efi_dvd() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then @@ -417,7 +386,17 @@ make_efi_dvd() { local src="${iso_root}/EFI/miso" mkdir -p "${src}" - prepare_fat_img "${src}" + local size=31M + local mnt="${mnt_dir}/efiboot" img="${src}/efiboot.img" + ${pxe_boot} && size=40M + msg2 "Creating fat image of %s ..." "${size}" + truncate -s ${size} "${img}" + mkfs.fat -n MISO_EFI "${img}" &>/dev/null + mkdir -p "${mnt}" + mount_img "${img}" "${mnt}" + prepare_efiboot_image "${mnt}" "${iso_root}" + prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd" + umount_img "${mnt}" : > ${work_dir}/build.${FUNCNAME} msg "Done [/efiboot/EFI]" @@ -493,17 +472,17 @@ compress_images(){ show_elapsed_time "${FUNCNAME}" "${timer}" } -prepare_boot_loaders(){ - local timer=$(get_timer) - run_safe "make_image_boot" - run_safe "make_isolinux" - run_safe "make_syslinux" - if [[ "${target_arch}" == "x86_64" ]]; then - run_safe "make_efi_usb" - run_safe "make_efi_dvd" - fi - show_elapsed_time "${FUNCNAME}" "${timer}" -} +# prepare_boot_loaders(){ +# local timer=$(get_timer) +# run_safe "make_image_boot" +# run_safe "make_isolinux" +# run_safe "make_syslinux" +# if [[ "${target_arch}" == "x86_64" ]]; then +# run_safe "make_efi_usb" +# run_safe "make_efi_dvd" +# fi +# show_elapsed_time "${FUNCNAME}" "${timer}" +# } prepare_images(){ local timer=$(get_timer) @@ -521,13 +500,13 @@ prepare_images(){ load_pkgs "${packages_mhwd}" run_safe "make_image_mhwd" fi -# run_safe "make_image_boot" -# run_safe "make_isolinux" -# run_safe "make_syslinux" -# if [[ "${target_arch}" == "x86_64" ]]; then -# run_safe "make_efi_usb" -# run_safe "make_efi_dvd" -# fi + run_safe "make_image_boot" + run_safe "make_isolinux" + run_safe "make_syslinux" + if [[ "${target_arch}" == "x86_64" ]]; then + run_safe "make_efi_usb" + run_safe "make_efi_dvd" + fi show_elapsed_time "${FUNCNAME}" "${timer}" } @@ -549,10 +528,10 @@ make_profile(){ ${verbose} && archive_logs exit 1 fi - if ${boot_only}; then - prepare_boot_loaders - exit 1 - fi +# if ${boot_only}; then +# prepare_boot_loaders +# exit 1 +# fi if ${images_only}; then prepare_images ${verbose} && archive_logs From 79a1220901a3b712d05b7c7411f99b05d8229798 Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 25 Oct 2016 11:12:12 +0200 Subject: [PATCH 03/18] buildiso: remove shared Packages-Desktop in favor of a profile based desktop list --- lib/util-iso.sh | 8 ++++---- lib/util-yaml.sh | 14 +++++++------- lib/util.sh | 28 +++------------------------- 3 files changed, 14 insertions(+), 36 deletions(-) diff --git a/lib/util-iso.sh b/lib/util-iso.sh index c9b8285..fae14e6 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -259,7 +259,7 @@ make_image_desktop() { pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt" cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt - [[ -e ${profile_dir}/${profile}-overlay ]] && copy_overlay "${profile_dir}/${profile}-overlay" "${path}" + [[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${path}" reset_pac_conf "${path}" @@ -271,7 +271,7 @@ make_image_desktop() { } mount_image_select(){ - if [[ -f "${packages_custom}" ]]; then + if [[ -f "${packages_desktop}" ]]; then mount_image_custom "$1" else mount_image "$1" @@ -488,8 +488,8 @@ prepare_images(){ local timer=$(get_timer) load_pkgs "${profile_dir}/Packages-Root" run_safe "make_image_root" - if [[ -f "${packages_custom}" ]] ; then - load_pkgs "${packages_custom}" + if [[ -f "${packages_desktop}" ]] ; then + load_pkgs "${packages_desktop}" run_safe "make_image_desktop" fi if [[ -f ${profile_dir}/Packages-Live ]]; then diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index 4764fe6..aff8606 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -135,7 +135,7 @@ write_unpack_conf(){ echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" - if [[ -f "${packages_custom}" ]] ; then + if [[ -f "${packages_desktop}" ]] ; then echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" @@ -234,9 +234,9 @@ write_postcfg_conf(){ get_yaml(){ local args=() ext="yaml" yaml if ${chrootcfg};then - args+=('netinstall') + args+=('chrootcfg') else - args+=("hybrid") + args+=("packages") fi args+=("${initsys}") [[ ${edition} == 'sonar' ]] && args+=("${edition}") @@ -399,7 +399,7 @@ write_pacman_group_yaml(){ } prepare_check(){ - profile=$1 + local profile=$1 edition=$(get_edition ${profile}) profile_dir=${run_dir}/${edition}/${profile} check_profile @@ -419,9 +419,9 @@ make_profile_yaml(){ prepare_check "$1" load_pkgs "${profile_dir}/Packages-Root" write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")" - if [[ -f "${packages_custom}" ]]; then - load_pkgs "${packages_custom}" - write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")" + if [[ -f "${packages_desktop}" ]]; then + load_pkgs "${packages_desktop}" + write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")" fi ${calamares} && write_calamares_yaml "$1" user_own "${cache_dir_netinstall}/$1" "-R" diff --git a/lib/util.sh b/lib/util.sh index dc14a99..0147988 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -493,7 +493,7 @@ reset_profile(){ unset disable_openrc unset enable_systemd_live unset enable_openrc_live - unset packages_custom + unset packages_desktop unset packages_mhwd unset login_shell unset tracker_url @@ -533,13 +533,7 @@ check_profile(){ die "Profile [%s] sanity check failed!" "${profile_dir}" fi - local files=$(ls ${profile_dir}/Packages*) - for f in ${files[@]};do - case $f in - ${profile_dir}/Packages-Root|${profile_dir}/Packages-Live|${profile_dir}/Packages-Mhwd) continue ;; - *) packages_custom="$f" ;; - esac - done + [[ -f "${profile_dir}/Packages-Desktop" ]] && packages_desktop=${profile_dir}/Packages-Desktop [[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd @@ -548,15 +542,6 @@ check_profile(){ fi } -get_shared_list(){ - local path - case ${edition} in - sonar|netrunner) path=${run_dir}/shared/${edition}/Packages-Desktop ;; - *) path=${run_dir}/shared/manjaro/Packages-Desktop ;; - esac - echo $path -} - # $1: file name load_pkgs(){ info "Loading Packages: [%s] ..." "${1##*/}" @@ -641,14 +626,7 @@ load_pkgs(){ _purge="s|>cleanup.*||g" \ _purge_rm="s|>cleanup||g" - local list="$1" - - if [[ "$list" == "${packages_custom}" ]];then - sort -u $(get_shared_list) ${packages_custom} > ${tmp_dir}/packages-desktop.list - list=${tmp_dir}/packages-desktop.list - fi - - packages=$(sed "$_com_rm" "$list" \ + packages=$(sed "$_com_rm" "$1" \ | sed "$_space" \ | sed "$_blacklist" \ | sed "$_purge" \ From 3b31aac16fb96af54f135f5ed32f480257a5c910 Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 25 Oct 2016 17:11:42 +0200 Subject: [PATCH 04/18] buildiso: adjust netgroups --- data/profile.conf.example | 2 +- lib/util.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/profile.conf.example b/data/profile.conf.example index cf59391..53420b0 100644 --- a/data/profile.conf.example +++ b/data/profile.conf.example @@ -38,7 +38,7 @@ # netinstall="false" # the default url for the netinstall.yaml -# netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst" +# netgroups="https://raw.githubusercontent.com/manjaro/iso-profiles/master/shared/netgroups" # configure calamares to use chrootcfg instead of unpackfs; default: unpackfs # chrootcfg="false" diff --git a/lib/util.sh b/lib/util.sh index 0147988..8982669 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -456,7 +456,7 @@ load_profile_config(){ #[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established # will be unlocked again after everything has been established. - netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst" + netgroups="https://raw.githubusercontent.com/manjaro/iso-profiles/master/shared/netgroups" [[ -z ${geoip} ]] && geoip='true' From 0e115f4850baf67b30c083dc4cc5ea4bf7022723 Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 25 Oct 2016 17:16:09 +0200 Subject: [PATCH 05/18] buildiso: update default repo var --- data/manjaro-tools.conf | 2 +- lib/util.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/manjaro-tools.conf b/data/manjaro-tools.conf index f6db0af..e4edf68 100644 --- a/data/manjaro-tools.conf +++ b/data/manjaro-tools.conf @@ -38,7 +38,7 @@ ################ buildiso ################ # the name of the profiles directory -# profile_repo='manjaro-tools-iso-profiles' +# profile_repo='iso-profiles' # default iso build list; name without .list extension # build_list_iso=default diff --git a/lib/util.sh b/lib/util.sh index 8982669..385d815 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -307,7 +307,7 @@ init_buildiso(){ [[ -z ${use_overlayfs} ]] && use_overlayfs='true' - [[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles' + [[ -z ${profile_repo} ]] && profile_repo='iso-profiles' mhwd_repo="/opt/pkg" } From b5ce1cb6f3759b163a79d1cbdb766b0394a05737 Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 25 Oct 2016 18:11:48 +0200 Subject: [PATCH 06/18] buildiso: add error handling for img mounts --- lib/util-iso-image.sh | 18 +++++++++++++----- lib/util-iso.sh | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 07b2b16..1c1df2a 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -20,16 +20,24 @@ copy_overlay(){ fi } +track_img() { + info "mount: [%s]" "$2" + mount "$@" && IMG_ACTIVE_MOUNTS=("$2" "${IMG_ACTIVE_MOUNTS[@]}") +} + mount_img() { + IMG_ACTIVE_MOUNTS=() mkdir -p "$2" - info "mount: [%s]" "$1" - mount "$1" "$2" + track_img "$1" "$2" } umount_img() { - info "umount: [%s]" "$1" - umount -d "$1" - rm -r "$1" + if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then + info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}" + umount "${IMG_ACTIVE_MOUNTS[@]}" + unset IMG_ACTIVE_MOUNTS + rm -r "$1" + fi } configure_plymouth(){ diff --git a/lib/util-iso.sh b/lib/util-iso.sh index fae14e6..5f657f0 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -23,6 +23,7 @@ error_function() { plain "Aborting..." fi umount_image + umount_img exit 2 } From 0f6da0cd354a7f7c01eec7c942546bc314a6519c Mon Sep 17 00:00:00 2001 From: udeved Date: Wed, 26 Oct 2016 12:49:26 +0200 Subject: [PATCH 07/18] util-yaml: set mhwdcfg local value to false if netinstall is true --- lib/util-yaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index aff8606..728dda7 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -211,7 +211,7 @@ write_mhwdcfg_conf(){ echo "driver: ${drv}" >> "$conf" echo '' >> "$conf" local switch='true' - ${chrootcfg} && switch='false' + ${netinstall} && switch='false' echo "local: ${switch}" >> "$conf" echo '' >> "$conf" echo 'repo: /opt/pacman-mhwd.conf' >> "$conf" From ac408e3f5aec8d4902b85e3f50acba78e72582de Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 1 Nov 2016 11:16:22 +0100 Subject: [PATCH 08/18] buildiso: use new netgroups repo for netgroups url --- lib/util-yaml.sh | 8 ++++---- lib/util.sh | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index 728dda7..7fb9692 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -232,18 +232,18 @@ write_postcfg_conf(){ } get_yaml(){ - local args=() ext="yaml" yaml + local args=() yaml if ${chrootcfg};then args+=('chrootcfg') else - args+=("packages") + args+=("${profile}/packages") fi args+=("${initsys}") [[ ${edition} == 'sonar' ]] && args+=("${edition}") for arg in ${args[@]};do yaml=${yaml:-}${yaml:+-}${arg} done - echo "${yaml}.${ext}" + echo "${yaml}.yaml" } write_netinstall_conf(){ @@ -399,7 +399,7 @@ write_pacman_group_yaml(){ } prepare_check(){ - local profile=$1 + profile=$1 edition=$(get_edition ${profile}) profile_dir=${run_dir}/${edition}/${profile} check_profile diff --git a/lib/util.sh b/lib/util.sh index 385d815..4968180 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -456,7 +456,7 @@ load_profile_config(){ #[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established # will be unlocked again after everything has been established. - netgroups="https://raw.githubusercontent.com/manjaro/iso-profiles/master/shared/netgroups" + netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master" [[ -z ${geoip} ]] && geoip='true' @@ -646,8 +646,7 @@ load_pkgs(){ if [[ $1 == "${packages_mhwd}" ]]; then - local _used_kernel=${kernel:5:2} - [[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g" + [[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g" packages_cleanup=$(sed "$_com_rm" "$1" \ | grep cleanup \ From eed6b43eb5a6ba3650648f6c9b0be158172e2a7e Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 1 Nov 2016 18:49:42 +0100 Subject: [PATCH 09/18] util-yaml: sync users.conf with upstream --- lib/util-yaml.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index 7fb9692..3d6f7bb 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -152,9 +152,11 @@ write_users_conf(){ echo " - $g" >> "$conf" done unset IFS - echo "autologinGroup: autologin" >> "$conf" - echo "sudoersGroup: wheel" >> "$conf" - echo "setRootPassword: true" >> "$conf" + echo "autologinGroup: autologin" >> "$conf" + echo "doAutologin: ${autologin}" >> "$conf" + echo "sudoersGroup: wheel" >> "$conf" + echo "setRootPassword: false" >> "$conf" + echo "availableShells: /bin/bash, /bin/zsh" >> "$conf" } write_packages_conf(){ From 355c25ad1e82f8bc0756daf25a9cfd36e53d32a1 Mon Sep 17 00:00:00 2001 From: udeved Date: Fri, 18 Nov 2016 16:53:01 +0100 Subject: [PATCH 10/18] data: update profile.conf example --- data/profile.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/profile.conf.example b/data/profile.conf.example index 53420b0..a4133bd 100644 --- a/data/profile.conf.example +++ b/data/profile.conf.example @@ -38,7 +38,7 @@ # netinstall="false" # the default url for the netinstall.yaml -# netgroups="https://raw.githubusercontent.com/manjaro/iso-profiles/master/shared/netgroups" +# netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master" # configure calamares to use chrootcfg instead of unpackfs; default: unpackfs # chrootcfg="false" From d5f045140d810ced28bbaeef994ace40746f5e03 Mon Sep 17 00:00:00 2001 From: udeved Date: Fri, 18 Nov 2016 16:53:49 +0100 Subject: [PATCH 11/18] buildiso: try to fix god damn plymouth plymouth pkg should go in the Packages-Live --- lib/util-iso-image.sh | 1 + lib/util-iso.sh | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 1c1df2a..fc478b5 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -221,6 +221,7 @@ configure_live_image(){ configure_mhwd "$1" configure_system "$1" configure_services "$1" + configure_plymouth "$1" configure_calamares "$1" write_live_session_conf "$1" msg "Done configuring [livefs]" diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 5f657f0..da25f0d 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -345,7 +345,6 @@ make_image_boot() { mkdir -p ${path} mount_image_live "${path}" - configure_plymouth "${path}" # if [[ ${gpg_key} ]]; then # gpg --export ${gpg_key} >${work_dir}/gpgkey From d736626694b4a110e7255788db735a3e183b71b6 Mon Sep 17 00:00:00 2001 From: Philip Date: Tue, 22 Nov 2016 08:04:29 +0100 Subject: [PATCH 12/18] [util-yaml] higher 'requiredStorage' to 8.0 GiB - see also: https://bugs.manjaro.org/index.php?do=details&task_id=95 - we might need a more dynamic approach and also think about NetInstall --- lib/util-yaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index 3d6f7bb..ea42f64 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -175,7 +175,7 @@ write_welcome_conf(){ echo "showReleaseNotesUrl: true" >> "$conf" echo '' >> "$conf" echo "requirements:" >> "$conf" - echo " requiredStorage: 5.5" >> "$conf" + echo " requiredStorage: 8.0" >> "$conf" echo " requiredRam: 1.0" >> "$conf" echo " check:" >> "$conf" echo " - storage" >> "$conf" From 118d140449c00d6cc4754ed3d7a6bee818a7dc5a Mon Sep 17 00:00:00 2001 From: Philip Date: Wed, 23 Nov 2016 19:44:31 +0100 Subject: [PATCH 13/18] [util-yaml] lower value 'requiredStorage' to 7.9 GiB - this might satisfy Windows-Klicki-Bunti users - however we should create a more dynamic approach and calculate the real need of space --- lib/util-yaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util-yaml.sh b/lib/util-yaml.sh index ea42f64..da8233d 100644 --- a/lib/util-yaml.sh +++ b/lib/util-yaml.sh @@ -175,7 +175,7 @@ write_welcome_conf(){ echo "showReleaseNotesUrl: true" >> "$conf" echo '' >> "$conf" echo "requirements:" >> "$conf" - echo " requiredStorage: 8.0" >> "$conf" + echo " requiredStorage: 7.9" >> "$conf" echo " requiredRam: 1.0" >> "$conf" echo " check:" >> "$conf" echo " - storage" >> "$conf" From 525195bccb6c1f39eca4fc2bb3d837cfaa809901 Mon Sep 17 00:00:00 2001 From: udeved Date: Thu, 1 Dec 2016 17:00:48 +0100 Subject: [PATCH 14/18] util-iso-image: configure thus for sonar --- lib/util-iso-image.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index fc478b5..ae64ce1 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -214,6 +214,29 @@ configure_system(){ esac } +configure_thus(){ + msg2 "Configuring Thus ..." + source "$1/etc/mkinitcpio.d/${kernel}.preset" + local conf="$1/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 = \"/bootmnt/${iso_name}/${target_arch}/root-image.sfs\"" >> "$conf" + echo "LIVE_MEDIA_DESKTOP = \"/bootmnt/${iso_name}/${target_arch}/desktop-image.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 $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 +} + configure_live_image(){ msg "Configuring [livefs]" configure_hosts "$1" @@ -223,6 +246,7 @@ configure_live_image(){ configure_services "$1" configure_plymouth "$1" configure_calamares "$1" + [[ ${edition} == "sonar" ]] && configure_thus "$1" write_live_session_conf "$1" msg "Done configuring [livefs]" } From ea4ab8b5e06eb57511be4e08b5be501d488113f3 Mon Sep 17 00:00:00 2001 From: udeved Date: Mon, 5 Dec 2016 21:24:16 +0100 Subject: [PATCH 15/18] manjaro-chroot: mount efivars --- bin/manjaro-chroot.in | 2 +- lib/util-mount.sh | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/bin/manjaro-chroot.in b/bin/manjaro-chroot.in index 5b609d8..8d88240 100644 --- a/bin/manjaro-chroot.in +++ b/bin/manjaro-chroot.in @@ -87,7 +87,7 @@ else ${pretend} && display_settings && exit 1 - chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" + chroot_api_efi_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind fi diff --git a/lib/util-mount.sh b/lib/util-mount.sh index 3f82480..48b0b0b 100644 --- a/lib/util-mount.sh +++ b/lib/util-mount.sh @@ -108,8 +108,8 @@ chroot_mount_partitions(){ chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind && chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro && -# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ -# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && + ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ + efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid && chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec && chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && @@ -130,6 +130,23 @@ chroot_mount_conditional() { fi } +chroot_api_efi_mount() { + CHROOT_ACTIVE_MOUNTS=() + [[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap' + trap 'chroot_api_efi_mount' EXIT + + chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind && + chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && + chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro && + ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ + efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && + chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid && + chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec && + chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && + chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 && + chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid +} + chroot_api_mount() { CHROOT_ACTIVE_MOUNTS=() [[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap' From b1d171b16d966ea8812c92f188c06069e585e045 Mon Sep 17 00:00:00 2001 From: udeved Date: Mon, 5 Dec 2016 21:28:10 +0100 Subject: [PATCH 16/18] util-mount: add umount handler for efi --- lib/util-mount.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/util-mount.sh b/lib/util-mount.sh index 48b0b0b..82ba164 100644 --- a/lib/util-mount.sh +++ b/lib/util-mount.sh @@ -133,7 +133,7 @@ chroot_mount_conditional() { chroot_api_efi_mount() { CHROOT_ACTIVE_MOUNTS=() [[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap' - trap 'chroot_api_efi_mount' EXIT + trap 'chroot_api_efi_umount' EXIT chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind && chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && @@ -155,8 +155,6 @@ chroot_api_mount() { chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind && chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev && chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro && -# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \ -# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev && chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid && chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec && chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && @@ -176,6 +174,12 @@ chroot_api_umount() { unset CHROOT_ACTIVE_MOUNTS } +chroot_api_efi_umount() { + #info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}" + umount "${CHROOT_ACTIVE_MOUNTS[@]}" + unset CHROOT_ACTIVE_MOUNTS +} + trap_handler(){ chroot_api_umount chroot_part_umount From b592c3fc8ff76aadad111c9347dbbc5a1cefa869 Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 6 Dec 2016 15:16:17 +0100 Subject: [PATCH 17/18] initcpio: install miso hooks in sysconfdir --- Makefile | 23 ++++++++++++++++++----- initcpio/install/miso_shutdown | 2 +- lib/util-iso-boot.sh | 8 ++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 20f41e3..af88680 100644 --- a/Makefile +++ b/Makefile @@ -187,13 +187,26 @@ install_iso: install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools - install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks - install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks - install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install - install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install +# install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio + +# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks +# install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks +# +# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install +# install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install + + + + install -m0755 ${CPIO} $(DESTDIR)$(SYSCONFDIR)/initcpio + + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks + install -m0755 ${CPIOHOOKS} $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks + + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/install + install -m0755 ${CPIOINST} $(DESTDIR)$(SYSCONFDIR)/initcpio/install + - install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools install -m0644 ${SHARED_ISO} $(DESTDIR)$(PREFIX)/share/manjaro-tools diff --git a/initcpio/install/miso_shutdown b/initcpio/install/miso_shutdown index e10f7f6..4bf99c5 100644 --- a/initcpio/install/miso_shutdown +++ b/initcpio/install/miso_shutdown @@ -5,7 +5,7 @@ build() { add_runscript - add_file /usr/lib/initcpio/miso_shutdown /shutdown + add_file /etc/initcpio/miso_shutdown /shutdown } help() { diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index c6d2b31..c4f542c 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -36,10 +36,10 @@ gen_boot_args(){ prepare_initcpio(){ msg2 "Copying initcpio ..." - cp /usr/lib/initcpio/hooks/miso* $1/etc/initcpio/hooks - cp /usr/lib/initcpio/install/miso* $1/etc/initcpio/install - cp /usr/lib/initcpio/miso_shutdown $1/etc/initcpio - sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown + cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks + cp /etc/initcpio/install/miso* $1/etc/initcpio/install + cp /etc/initcpio/miso_shutdown $1/etc/initcpio +# sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown } prepare_initramfs(){ From ffbcf89fa393f2aad264e739892272d8d7972b8e Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 6 Dec 2016 15:20:14 +0100 Subject: [PATCH 18/18] fix makefile --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index af88680..44ba01f 100644 --- a/Makefile +++ b/Makefile @@ -187,18 +187,13 @@ install_iso: install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools - -# install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio - # install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks # install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks # # install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install # install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install - - - install -m0755 ${CPIO} $(DESTDIR)$(SYSCONFDIR)/initcpio +# install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks install -m0755 ${CPIOHOOKS} $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks @@ -206,6 +201,7 @@ install_iso: install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/install install -m0755 ${CPIOINST} $(DESTDIR)$(SYSCONFDIR)/initcpio/install + install -m0755 ${CPIO} $(DESTDIR)$(SYSCONFDIR)/initcpio install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools @@ -254,9 +250,9 @@ uninstall_iso: for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done - for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/$$f; done - for f in ${CPIOINST}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/$$f; done - for f in ${CPIO}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/$$f; done + for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks/$$f; done + for f in ${CPIOINST}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/install/$$f; done + for f in ${CPIO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/$$f; done rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz rm -f $(DESTDIR)$(PREFIX)/share/man/man1/deployiso.1.gz rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz