diff --git a/.project b/.project new file mode 100644 index 0000000..17bab97 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + manjaro-tools + + + + + + + + diff --git a/Makefile b/Makefile index 5dcf0fc..63079fd 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ LIBS_ISO = \ lib/util-publish.sh SHARED_ISO = \ - data/pacman-gfx.conf \ + data/pacman-mhwd.conf \ data/desktop.map \ data/profile.conf.example diff --git a/bin/buildiso.in b/bin/buildiso.in index 61db818..517e458 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -27,15 +27,16 @@ show_profile(){ msg2 "iso_dir: %s" "${iso_dir}" msg2 "iso_file: %s" "${iso_file}" msg2 "autologin: %s" "${autologin}" - msg2 "nonfree_xorg: %s" "${nonfree_xorg}" + msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}" msg2 "pxe_boot: %s" "${pxe_boot}" msg2 "plymouth_boot: %s" "${plymouth_boot}" ${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}" [[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}" - msg2 "cal_netinstall: %s" "${cal_netinstall}" - msg2 "cal_unpackfs: %s" "${cal_unpackfs}" + msg2 "netinstall: %s" "${netinstall}" + ${netinstall} && msg2 "netgroups: %s" "$(get_yaml)" + msg2 "unpackfs: %s" "${unpackfs}" msg2 "efi_boot_loader: %s" "${efi_boot_loader}" diff --git a/data/pacman-gfx.conf b/data/pacman-mhwd.conf similarity index 98% rename from data/pacman-gfx.conf rename to data/pacman-mhwd.conf index 42609e2..b514635 100644 --- a/data/pacman-gfx.conf +++ b/data/pacman-mhwd.conf @@ -66,6 +66,6 @@ SigLevel = Never # uncommented to enable the repo. # -[gfx-pkgs] +[mhwd] #SigLevel = Optional TrustAll -Server = file:///opt/live/pkgs +Server = file:///opt/pkg diff --git a/data/profile.conf.example b/data/profile.conf.example index 862c24a..c9c7bc7 100644 --- a/data/profile.conf.example +++ b/data/profile.conf.example @@ -13,7 +13,7 @@ # multilib="true" # nonfree xorg drivers -# nonfree_xorg="true" +# nonfree_mhwd="true" # use plymouth # plymouth_boot="true" @@ -35,13 +35,13 @@ # efi_boot_loader="grub" # configure calamares for netinstall -# cal_netinstall="false" +# netinstall="false" # the default url for the netinstall.yaml -# cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master" +# netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinstall" # configure calamares to use chrootcfg instead of unpackfs -# cal_unpackfs="true" +# unpackfs="true" # unset defaults to given value # plymouth_theme=manjaro-elegant diff --git a/docbook/profile.conf.xml b/docbook/profile.conf.xml index 6e03a18..607cfd0 100644 --- a/docbook/profile.conf.xml +++ b/docbook/profile.conf.xml @@ -132,7 +132,7 @@ - cal_netinstall= + netinstall= Accepts (the default) @@ -141,7 +141,7 @@ - cal_unpackfs= + unpackfs= Accepts (the default) @@ -150,7 +150,7 @@ - cal_netgroups= + netgroups= Default url for the netinstall.yaml. diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index eb49c64..7d6bb31 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -227,7 +227,7 @@ write_isolinux_cfg(){ echo " append ${initrd_arg} misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=free ${boot_args[@]} showopts" >> ${conf} echo '' >> ${conf} - if ${nonfree_xorg};then + if ${nonfree_mhwd};then echo "label nonfree" >> ${conf} echo " kernel /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf} echo " append ${initrd_arg} misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=0 i915.modeset=1 radeon.modeset=0 nonfree=yes logo.nologo overlay=nonfree ${boot_args[@]} showopts" >> ${conf} @@ -255,7 +255,7 @@ write_isolinux_msg(){ echo '' >> ${conf} echo "Available boot options:" >> ${conf} echo "start - Start ${dist_name} Live System" >> ${conf} - if ${nonfree_xorg};then + if ${nonfree_mhwd};then echo "nonfree - Start with proprietary drivers" >> ${conf} fi echo "harddisk - Boot from local hard disk" >> ${conf} diff --git a/lib/util-iso-calamares.sh b/lib/util-iso-calamares.sh index d1cb98f..388b3ab 100644 --- a/lib/util-iso-calamares.sh +++ b/lib/util-iso-calamares.sh @@ -120,7 +120,7 @@ write_unpack_conf(){ echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" - if ! ${cal_netinstall};then + if [[ -f "${packages_custom}" ]] ; then echo " - source: \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" @@ -168,7 +168,7 @@ write_welcome_conf(){ echo " - storage" >> "$conf" echo " - ram" >> "$conf" echo " - root" >> "$conf" - if ${cal_netinstall};then + if ${netinstall};then echo " - internet" >> "$conf" fi } @@ -183,7 +183,7 @@ write_settings_conf(){ echo "sequence:" >> "$conf" echo "- show:" >> "$conf" echo " - welcome" >> "$conf" - ${cal_netinstall} && echo " - netinstall" >> "$conf" + ${netinstall} && echo " - netinstall" >> "$conf" echo " - locale" >> "$conf" echo " - keyboard" >> "$conf" echo " - partition" >> "$conf" @@ -192,13 +192,14 @@ write_settings_conf(){ echo "- exec:" >> "$conf" echo " - partition" >> "$conf" echo " - mount" >> "$conf" - if ${cal_netinstall};then - if ${cal_unpackfs};then + if ${netinstall};then + if ${unpackfs};then echo " - unpackfs" >> "$conf" echo " - networkcfg" >> "$conf" echo " - packages" >> "$conf" else echo " - chrootcfg" >> "$conf" + echo " - networkcfg" >> "$conf" fi else echo " - unpackfs" >> "$conf" @@ -216,7 +217,6 @@ write_settings_conf(){ echo " - users" >> "$conf" echo " - displaymanager" >> "$conf" echo " - mhwdcfg" >> "$conf" - echo " - networkcfg" >> "$conf" echo " - hwclock" >> "$conf" if [[ ${initsys} == 'systemd' ]];then echo " - services" >> "$conf" @@ -240,10 +240,6 @@ write_settings_conf(){ write_mhwdcfg_conf(){ local conf="$1/etc/calamares/modules/mhwdcfg.conf" echo "---" > "$conf" - echo "bus:" >> "$conf" - echo " - pci" >> "$conf" - echo " - usb" >> "$conf" - echo '' >> "$conf" echo "identifier:" >> "$conf" echo " net:" >> "$conf" echo " - 200" >> "$conf" @@ -251,14 +247,18 @@ write_mhwdcfg_conf(){ echo " video:" >> "$conf" echo " - 300" >> "$conf" echo '' >> "$conf" - if ${nonfree_xorg};then + echo "bus:" >> "$conf" + echo " - pci" >> "$conf" + echo " - usb" >> "$conf" + echo '' >> "$conf" + if ${nonfree_mhwd};then echo "driver: nonfree" >> "$conf" else echo "driver: free" >> "$conf" fi echo '' >> "$conf" - if ${cal_netinstall};then - if ${cal_unpackfs};then + if ${netinstall};then + if ${unpackfs};then echo "local: true" >> "$conf" else echo "local: false" >> "$conf" @@ -266,12 +266,16 @@ write_mhwdcfg_conf(){ else echo "local: true" >> "$conf" fi + echo '' >> "$conf" + echo 'repo: /opt/pacman-mhwd.conf' >> "$conf" } write_chrootcfg_conf(){ local conf="$1/etc/calamares/modules/chrootcfg.conf" mode='"0o755"' echo "---" > "$conf" echo "requirements:" >> "$conf" + echo " - name: /etc" >> "$conf" + echo " mode: ${mode}" >> "$conf" echo " - name: /var/cache/pacman/pkg" >> "$conf" echo " mode: ${mode}" >> "$conf" echo " - name: /var/lib/pacman" >> "$conf" @@ -282,12 +286,50 @@ write_chrootcfg_conf(){ echo " - manjaro" >> "$conf" } +write_postcfg_conf(){ + local conf="$1/etc/calamares/modules/postcfg.conf" + echo "---" > "$conf" + echo "keyrings:" >> "$conf" + echo " - archlinux" >> "$conf" + echo " - manjaro" >> "$conf" +} + +get_yaml(){ + local args=() ext="yaml" yaml + if ${unpackfs};then + args+=("hybrid") + else + args+=('netinstall') + fi + [[ ${initsys} == 'openrc' ]] && args+=("${initsys}") + [[ ${edition} == 'sonar' ]] && args+=("${edition}") + for arg in ${args[@]};do + yaml=${yaml:-}${yaml:+-}${arg} + done + echo "${yaml}.${ext}" +} + write_netinstall_conf(){ local conf="$1/etc/calamares/modules/netinstall.conf" - local yaml="netinstall.yaml" - [[ ${initsys} == 'openrc' ]] && yaml="netinstall-${initsys}.yaml" echo "---" > "$conf" - echo "groupsUrl: ${cal_netgroups}/${yaml}" >> "$conf" + echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf" +} + +write_grubcfg_conf(){ + local conf="$1/etc/calamares/modules/grubcfg.conf" + echo "---" > "$conf" + echo "overwrite: false" >> "$conf" + echo '' >> "$conf" + echo "defaults:" >> "$conf" + echo " GRUB_TIMEOUT: 5" >> "$conf" + echo ' GRUB_DEFAULT: "saved"' >> "$conf" + echo " GRUB_DISABLE_SUBMENU: true" >> "$conf" + echo ' GRUB_TERMINAL_OUTPUT: "console"' >> "$conf" + echo " GRUB_DISABLE_RECOVERY: true" >> "$conf" + if ${plymouth_boot};then + echo '' >> "$conf" + echo "plymouth_theme: ${plymouth_theme}" + fi } configure_calamares(){ @@ -315,10 +357,14 @@ configure_calamares(){ write_finished_conf "$1" - write_netinstall_conf "$1" + ${netinstall} && write_netinstall_conf "$1" write_chrootcfg_conf "$1" + write_postcfg_conf "$1" + + write_grubcfg_conf "$1" + write_services_conf "$1" write_users_conf "$1" } diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index d416369..2b95445 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -10,11 +10,13 @@ # GNU General Public License for more details. copy_overlay(){ - msg2 "Copying [%s] ..." "${1##*/}" - if [[ -L $1 ]];then - cp -a --no-preserve=ownership $1/* $2 - else - cp -LR $1/* $2 + if [[ -e $1 ]];then + msg2 "Copying [%s] ..." "${1##*/}" + if [[ -L $1 ]];then + cp -a --no-preserve=ownership $1/* $2 + else + cp -LR $1/* $2 + fi fi } @@ -48,9 +50,8 @@ set_xdm(){ fi } -# $1: chroot configure_mhwd_drivers(){ - local path=$1/opt/live/pkgs/ \ + local path=$1${mhwd_repo}/ \ 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 @@ -101,8 +102,6 @@ chroot_clean(){ rm -rf --one-file-system "$1" } - -# $1: chroot configure_lsb(){ [[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg if [ -e $1/etc/lsb-release ] ; then @@ -264,11 +263,9 @@ configure_live_image(){ } make_repo(){ - repo-add $1/opt/live/pkgs/gfx-pkgs.db.tar.gz $1/opt/live/pkgs/*pkg*z + repo-add $1${mhwd_repo}/mhwd.db.tar.gz $1${mhwd_repo}/*pkg*z } -# $1: work dir -# $2: pkglist copy_from_cache(){ local list="${tmp_dir}"/mhwd-cache.list chroot-run \ @@ -287,11 +284,9 @@ copy_from_cache(){ sed -i "s/.*\///" "$list" msg2 "Copying mhwd package cache ..." - rsync -v --files-from="$list" /var/cache/pacman/pkg "$1/opt/live/pkgs" + rsync -v --files-from="$list" /var/cache/pacman/pkg "$1${mhwd_repo}" } -# $1: image path -# $2: packages chroot_create(){ [[ "${1##*/}" == "root-image" ]] && local flag="-L" setarch "${target_arch}" \ diff --git a/lib/util-iso.sh b/lib/util-iso.sh index b66b16a..9e12411 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -180,10 +180,10 @@ make_checksum(){ gen_iso_fn(){ local vars=() name vars+=("${iso_name}") - if ! ${cal_netinstall};then + if ! ${netinstall};then [[ -n ${profile} ]] && vars+=("${profile}") else - if ${cal_unpackfs};then + if ${unpackfs};then [[ -n ${profile} ]] && vars+=("${profile}") fi fi @@ -285,7 +285,7 @@ make_image_mhwd() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then msg "Prepare [drivers repository] (mhwd-image)" local path="${work_dir}/mhwd-image" - mkdir -p ${path}/opt/live/pkgs + mkdir -p ${path}${mhwd_repo} mount_image_select "${path}" @@ -295,10 +295,10 @@ make_image_mhwd() { if [[ -n "${packages_cleanup}" ]]; then for mhwd_clean in ${packages_cleanup}; do - rm ${path}/opt/live/pkgs/${mhwd_clean} + rm ${path}${mhwd_repo}/${mhwd_clean} done fi - cp ${DATADIR}/pacman-gfx.conf ${path}/opt/live + cp ${DATADIR}/pacman-mhwd.conf ${path}/opt make_repo "${path}" configure_mhwd_drivers "${path}" @@ -442,7 +442,7 @@ load_pkgs(){ _multi="s|>multilib.*||g" _nonfree_multi="s|>nonfree_multilib.*||g" _nonfree_x86_64="s|>nonfree_x86_64.*||g" - if ${nonfree_xorg};then + if ${nonfree_mhwd};then _nonfree_default="s|>nonfree_default||g" _nonfree_i686="s|>nonfree_i686||g" @@ -456,7 +456,7 @@ load_pkgs(){ _nonfree_i686="s|>nonfree_i686.*||g" if ${multilib};then _multi="s|>multilib||g" - if ${nonfree_xorg};then + if ${nonfree_mhwd};then _nonfree_default="s|>nonfree_default||g" _nonfree_x86_64="s|>nonfree_x86_64||g" _nonfree_multi="s|>nonfree_multilib||g" @@ -467,7 +467,7 @@ load_pkgs(){ fi else _multi="s|>multilib.*||g" - if ${nonfree_xorg};then + if ${nonfree_mhwd};then _nonfree_default="s|>nonfree_default||g" _nonfree_x86_64="s|>nonfree_x86_64||g" _nonfree_multi="s|>nonfree_multilib.*||g" @@ -563,8 +563,8 @@ check_profile(){ [[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd - if ! ${cal_netinstall};then - cal_unpackfs="true" + if ! ${netinstall};then + unpackfs="true" fi } @@ -657,7 +657,7 @@ reset_profile(){ unset multilib unset pxe_boot unset plymouth_boot - unset nonfree_xorg + unset nonfree_mhwd unset efi_boot_loader unset hostname unset username @@ -675,8 +675,9 @@ reset_profile(){ unset login_shell unset tracker_url unset piece_size - unset cal_netinstall - unset cal_unpackfs + unset netinstall + unset unpackfs + unset netgroups } make_profile(){ diff --git a/lib/util.sh b/lib/util.sh index 803085b..0549623 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -312,6 +312,8 @@ init_buildiso(){ [[ -z ${use_overlayfs} ]] && use_overlayfs='true' [[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles' + + mhwd_repo="/opt/pkg" } init_deployiso(){ @@ -356,8 +358,8 @@ check_profile_vars(){ if ! is_valid_bool "${multilib}";then die "multilib only accepts true/false value!" fi - if ! is_valid_bool "${nonfree_xorg}";then - die "nonfree_xorg only accepts true/false value!" + if ! is_valid_bool "${nonfree_mhwd}";then + die "nonfree_mhwd only accepts true/false value!" fi if ! is_valid_bool "${plymouth_boot}";then die "plymouth_boot only accepts true/false value!" @@ -365,11 +367,11 @@ check_profile_vars(){ if ! is_valid_bool "${pxe_boot}";then die "pxe_boot only accepts true/false value!" fi - if ! is_valid_bool "${cal_netinstall}";then - die "cal_netinstall only accepts true/false value!" + if ! is_valid_bool "${netinstall}";then + die "netinstall only accepts true/false value!" fi - if ! is_valid_bool "${cal_unpackfs}";then - die "cal_unpackfs only accepts true/false value!" + if ! is_valid_bool "${unpackfs}";then + die "unpackfs only accepts true/false value!" fi } @@ -402,7 +404,7 @@ load_profile_config(){ [[ -z ${plymouth_boot} ]] && plymouth_boot="true" [[ ${initsys} == 'openrc' ]] && plymouth_boot="false" - [[ -z ${nonfree_xorg} ]] && nonfree_xorg="true" + [[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true" [[ -z ${efi_boot_loader} ]] && efi_boot_loader="grub" @@ -449,11 +451,15 @@ load_profile_config(){ [[ -z ${piece_size} ]] && piece_size=21 - [[ -z ${cal_netinstall} ]] && cal_netinstall='false' + [[ -z ${netinstall} ]] && netinstall='false' - [[ -z ${cal_unpackfs} ]] && cal_unpackfs='true' + [[ -z ${unpackfs} ]] && unpackfs='true' - [[ -z ${cal_netgroups} ]] && cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master" + [[ -z ${netgroups} ]] && netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinstall" + + if ! ${unpackfs} && ! ${netinstall};then + netinstall='true' + fi check_profile_vars