Merge branch 'master' into stable-0.13.x

This commit is contained in:
Philip 2016-08-28 13:35:40 +02:00
commit c61f1ac9ba
15 changed files with 357 additions and 53 deletions

View file

@ -64,7 +64,8 @@ LIST_ISO = \
BIN_ISO = \ BIN_ISO = \
bin/buildiso \ bin/buildiso \
bin/testiso \ bin/testiso \
bin/deployiso bin/deployiso \
bin/check-yaml
LIBS_ISO = \ LIBS_ISO = \
lib/util-iso.sh \ lib/util-iso.sh \
@ -73,11 +74,13 @@ LIBS_ISO = \
lib/util-iso-image.sh \ lib/util-iso-image.sh \
lib/util-iso-calamares.sh \ lib/util-iso-calamares.sh \
lib/util-iso-boot.sh \ lib/util-iso-boot.sh \
lib/util-publish.sh lib/util-publish.sh \
lib/util-iso-yaml.sh
SHARED_ISO = \ SHARED_ISO = \
data/pacman-mhwd.conf \ data/pacman-mhwd.conf \
data/desktop.map \ data/desktop.map \
data/linux.preset \
data/profile.conf.example data/profile.conf.example
CPIOHOOKS = \ CPIOHOOKS = \

View file

@ -260,8 +260,43 @@ The branch can be defined also in manjaro-tools.conf, but a manual parameter wil
######* -z ######* -z
* Use this to sqfs compress the chroots if you previously used -x. * Use this to sqfs compress the chroots if you previously used -x.
###4. check-yaml
###4. buildtree check-yaml can be used to write profile package lists to yaml.
It is also possible to generate calamares conf file as buildiso would do.
yaml files are used by calamares netinstall option from a specified url(netgroups).
~~~
$ check-yaml -h
Usage: check-yaml [options]
-p <profile> Buildset or profile [default: default]
-a <arch> Arch [default: x86_64]
-k <name> Kernel to use[default: linux44]
-i <name> Init system to use [default: systemd]
-c Check also calamares yaml files generated for the profile
-q Query settings
-h This help
~~~
######* build xfce iso profile for both arches and branch testing on x86_64 build system
* i686 (buildsystem is x86_64)
~~~
check-yaml -p xfce -a i686 -c
~~~
* for x86_64
~~~
check-yaml -p xfce -c
~~~
####Special parameters
######* -c
* generate calamares module and settings conf files per profile
###5. buildtree
buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos. buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos.
@ -283,7 +318,7 @@ Usage: buildtree [options]
buildtree -as buildtree -as
~~~ ~~~
###5. manjaro-chroot ###6. manjaro-chroot
manjaro-chroot is a little tool to quickly chroot into a second system installed on the host. manjaro-chroot is a little tool to quickly chroot into a second system installed on the host.
If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from. If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from.
@ -316,7 +351,7 @@ manjaro-chroot -a
manjaro-chroot /mnt /bin/bash manjaro-chroot /mnt /bin/bash
~~~ ~~~
###6. deployiso ###7. deployiso
deployiso is a script to upload a specific iso or a buiildset to SF. deployiso is a script to upload a specific iso or a buiildset to SF.
It needs to be run inside the iso-profiles directory. It needs to be run inside the iso-profiles directory.

View file

@ -45,6 +45,7 @@ show_profile(){
msg2 "password: %s" "${password}" msg2 "password: %s" "${password}"
msg2 "login_shell: %s" "${login_shell}" msg2 "login_shell: %s" "${login_shell}"
msg2 "addgroups: %s" "${addgroups}" 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: %s" "${enable_systemd[*]}"

139
bin/check-yaml.in Normal file
View file

@ -0,0 +1,139 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
version=@version@
LIBDIR='@libdir@'
DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-iso-yaml.sh
show_profile(){
prepare_check "$1"
msg2 "yaml_dir: %s" "${yaml_dir}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "autologin: %s" "${autologin}"
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 "netinstall: %s" "${netinstall}"
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
msg2 "unpackfs: %s" "${unpackfs}"
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
msg2 "hostname: %s" "${hostname}"
msg2 "username: %s" "${username}"
msg2 "password: %s" "${password}"
msg2 "login_shell: %s" "${login_shell}"
msg2 "addgroups: %s" "${addgroups}"
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[*]}"
else
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
fi
reset_profile
unset yaml_dir
}
display_settings(){
show_version
show_config
msg "PROFILE:"
msg2 "list_dir_iso: %s" "${list_dir_iso}"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
msg2 "build_list_iso: %s" "${build_list_iso}"
msg2 "is_build_list: %s" "${is_build_list}"
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
${verbose} && msg2 "run_dir: %s" "${run_dir}"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
msg "ARGS:"
msg2 "calamares: %s" "${calamares}"
msg "CHECK QUEUE:"
run show_profile "${build_list_iso}"
}
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
# to force old way to have buildiso run in iso-profiles dir
# run_dir=$(pwd)
load_run_dir "${profile_repo}"
calamares=false
pretend=false
cache_dir_netinstall="${cache_dir}/netinstall"
usage() {
echo "Usage: ${0##*/} [options]"
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo " -a <arch> Arch [default: ${target_arch}]"
echo " -k <name> Kernel to use[default: ${kernel}]"
echo " -i <name> Init system to use [default: ${initsys}]"
echo ' -c Check also calamares yaml files generated for the profile'
echo ' -q Query settings'
echo ' -h This help'
echo ''
echo ''
exit $1
}
orig_argv=("$@")
opts='p:a:i:k:cqh'
while getopts "${opts}" arg; do
case "${arg}" in
p) build_list_iso="$OPTARG" ;;
a) target_arch="$OPTARG" ;;
i) initsys="$OPTARG" ;;
k) kernel="$OPTARG" ;;
c) calamares=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
done
shift $(($OPTIND - 1))
check_root "$0" "${orig_argv[@]}"
prepare_dir "${tmp_dir}"
eval_build_list "${list_dir_iso}" "${build_list_iso}"
${pretend} && display_settings && exit 1
run make_profile_yaml "${build_list_iso}"

View file

@ -111,7 +111,7 @@ if ${build_locales};then
info "Using build locales ..." info "Using build locales ..."
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak" mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak"
mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak" mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak"
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen"
printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf" printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf" printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
fi fi

View file

@ -2,7 +2,7 @@ autoconf
automake automake
binutils binutils
bison bison
eudev-systemdcompat libeudev-systemd
fakeroot fakeroot
file file
findutils findutils

14
data/linux.preset Normal file
View file

@ -0,0 +1,14 @@
# mkinitcpio preset file for the 'linux' package
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-@kvmaj@.@kvmin@-@arch@"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-@kvmaj@.@kvmin@-@arch@.img"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-@kvmaj@.@kvmin@-@arch@-fallback.img"
fallback_options="-S autodetect"

View file

@ -65,6 +65,9 @@
# unset defaults to given values # unset defaults to given values
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel" # addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
# the same workgroup name if samba is used
# smb_workgroup="Manjaro"
################# live-session ################# ################# live-session #################
# unset defaults to given value # unset defaults to given value

View file

@ -193,7 +193,7 @@ copy_isolinux_bin(){
gen_boot_args(){ gen_boot_args(){
local args=(quiet) local args=(quiet)
if ${plymouth_boot};then if ${plymouth_boot};then
[[ ${initsys} == 'systemd' ]] && args+=(splash) args+=(splash)
fi fi
echo ${args[@]} echo ${args[@]}
} }

View file

@ -11,6 +11,7 @@
write_machineid_conf(){ write_machineid_conf(){
local conf="$1/etc/calamares/modules/machineid.conf" local conf="$1/etc/calamares/modules/machineid.conf"
msg2 "Writing %s ..." "${conf##*/}"
if [[ ${initsys} == 'openrc' ]];then if [[ ${initsys} == 'openrc' ]];then
echo "systemd: false" > $conf echo "systemd: false" > $conf
echo "dbus: true" >> $conf echo "dbus: true" >> $conf
@ -23,6 +24,7 @@ write_machineid_conf(){
} }
write_finished_conf(){ write_finished_conf(){
msg2 "Writing %s ..." "finished.conf"
local conf="$1/etc/calamares/modules/finished.conf" local conf="$1/etc/calamares/modules/finished.conf"
echo '---' > "$conf" echo '---' > "$conf"
echo 'restartNowEnabled: true' >> "$conf" echo 'restartNowEnabled: true' >> "$conf"
@ -35,8 +37,9 @@ write_finished_conf(){
} }
write_bootloader_conf(){ write_bootloader_conf(){
source "$1/etc/mkinitcpio.d/${kernel}.preset"
local conf="$1/etc/calamares/modules/bootloader.conf" local conf="$1/etc/calamares/modules/bootloader.conf"
msg2 "Writing %s ..." "${conf##*/}"
source "$2"
echo '---' > "$conf" echo '---' > "$conf"
echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf" echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf"
echo "kernel: \"$(echo ${ALL_kver} | sed s'|/boot||')\"" >> "$conf" echo "kernel: \"$(echo ${ALL_kver} | sed s'|/boot||')\"" >> "$conf"
@ -54,6 +57,7 @@ write_bootloader_conf(){
write_services_conf(){ write_services_conf(){
if [[ ${initsys} == 'openrc' ]];then if [[ ${initsys} == 'openrc' ]];then
local conf="$1/etc/calamares/modules/servicescfg.conf" local conf="$1/etc/calamares/modules/servicescfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf" echo '---' > "$conf"
echo '' >> "$conf" echo '' >> "$conf"
echo 'services:' >> "$conf" echo 'services:' >> "$conf"
@ -72,6 +76,7 @@ write_services_conf(){
fi fi
else else
local conf="$1/etc/calamares/modules/services.conf" local conf="$1/etc/calamares/modules/services.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf" echo '---' > "$conf"
echo '' >> "$conf" echo '' >> "$conf"
echo 'services:' > "$conf" echo 'services:' > "$conf"
@ -95,6 +100,7 @@ write_services_conf(){
write_displaymanager_conf(){ write_displaymanager_conf(){
local conf="$1/etc/calamares/modules/displaymanager.conf" local conf="$1/etc/calamares/modules/displaymanager.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "displaymanagers:" > "$conf" echo "displaymanagers:" > "$conf"
echo " - ${displaymanager}" >> "$conf" echo " - ${displaymanager}" >> "$conf"
echo '' >> "$conf" echo '' >> "$conf"
@ -109,12 +115,14 @@ write_displaymanager_conf(){
write_initcpio_conf(){ write_initcpio_conf(){
local conf="$1/etc/calamares/modules/initcpio.conf" local conf="$1/etc/calamares/modules/initcpio.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "kernel: ${kernel}" >> "$conf" echo "kernel: ${kernel}" >> "$conf"
} }
write_unpack_conf(){ write_unpack_conf(){
local conf="$1/etc/calamares/modules/unpackfs.conf" local conf="$1/etc/calamares/modules/unpackfs.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "unpack:" >> "$conf" echo "unpack:" >> "$conf"
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf" echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf"
@ -129,6 +137,7 @@ write_unpack_conf(){
write_users_conf(){ write_users_conf(){
local conf="$1/etc/calamares/modules/users.conf" local conf="$1/etc/calamares/modules/users.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "userGroup: users" >> "$conf" echo "userGroup: users" >> "$conf"
echo "defaultGroups:" >> "$conf" echo "defaultGroups:" >> "$conf"
@ -144,12 +153,14 @@ write_users_conf(){
write_packages_conf(){ write_packages_conf(){
local conf="$1/etc/calamares/modules/packages.conf" local conf="$1/etc/calamares/modules/packages.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "backend: pacman" >> "$conf" echo "backend: pacman" >> "$conf"
} }
write_welcome_conf(){ write_welcome_conf(){
local conf="$1/etc/calamares/modules/welcome.conf" local conf="$1/etc/calamares/modules/welcome.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" >> "$conf" echo "---" > "$conf" >> "$conf"
echo "showSupportUrl: true" >> "$conf" echo "showSupportUrl: true" >> "$conf"
echo "showKnownIssuesUrl: true" >> "$conf" echo "showKnownIssuesUrl: true" >> "$conf"
@ -175,6 +186,7 @@ write_welcome_conf(){
write_settings_conf(){ write_settings_conf(){
local conf="$1/etc/calamares/settings.conf" local conf="$1/etc/calamares/settings.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "modules-search: [ local ]" >> "$conf" echo "modules-search: [ local ]" >> "$conf"
echo '' >> "$conf" echo '' >> "$conf"
@ -239,6 +251,7 @@ write_settings_conf(){
write_mhwdcfg_conf(){ write_mhwdcfg_conf(){
local conf="$1/etc/calamares/modules/mhwdcfg.conf" local conf="$1/etc/calamares/modules/mhwdcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "identifier:" >> "$conf" echo "identifier:" >> "$conf"
echo " net:" >> "$conf" echo " net:" >> "$conf"
@ -272,6 +285,7 @@ write_mhwdcfg_conf(){
write_chrootcfg_conf(){ write_chrootcfg_conf(){
local conf="$1/etc/calamares/modules/chrootcfg.conf" mode='"0o755"' local conf="$1/etc/calamares/modules/chrootcfg.conf" mode='"0o755"'
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "requirements:" >> "$conf" echo "requirements:" >> "$conf"
echo " - name: /etc" >> "$conf" echo " - name: /etc" >> "$conf"
@ -288,10 +302,14 @@ write_chrootcfg_conf(){
write_postcfg_conf(){ write_postcfg_conf(){
local conf="$1/etc/calamares/modules/postcfg.conf" local conf="$1/etc/calamares/modules/postcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "keyrings:" >> "$conf" echo "keyrings:" >> "$conf"
echo " - archlinux" >> "$conf" echo " - archlinux" >> "$conf"
echo " - manjaro" >> "$conf" echo " - manjaro" >> "$conf"
echo "" >> "$conf"
echo "samba:" >> "$conf"
echo " - workgroup: ${smb_workgroup}" >> "$conf"
} }
get_yaml(){ get_yaml(){
@ -311,12 +329,14 @@ get_yaml(){
write_netinstall_conf(){ write_netinstall_conf(){
local conf="$1/etc/calamares/modules/netinstall.conf" local conf="$1/etc/calamares/modules/netinstall.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf" echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf"
} }
write_grubcfg_conf(){ write_grubcfg_conf(){
local conf="$1/etc/calamares/modules/grubcfg.conf" local conf="$1/etc/calamares/modules/grubcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" echo "---" > "$conf"
echo "overwrite: false" >> "$conf" echo "overwrite: false" >> "$conf"
echo '' >> "$conf" echo '' >> "$conf"
@ -328,12 +348,12 @@ write_grubcfg_conf(){
echo " GRUB_DISABLE_RECOVERY: true" >> "$conf" echo " GRUB_DISABLE_RECOVERY: true" >> "$conf"
if ${plymouth_boot};then if ${plymouth_boot};then
echo '' >> "$conf" echo '' >> "$conf"
echo "plymouth_theme: ${plymouth_theme}" echo "plymouth_theme: ${plymouth_theme}" >> "$conf"
fi fi
} }
configure_calamares(){ configure_calamares(){
msg2 "Configuring Calamares ..." info "Configuring [Calamares]"
mkdir -p $1/etc/calamares/modules mkdir -p $1/etc/calamares/modules
@ -343,7 +363,7 @@ configure_calamares(){
write_packages_conf "$1" write_packages_conf "$1"
write_bootloader_conf "$1" write_bootloader_conf "$1" "$2"
write_mhwdcfg_conf "$1" write_mhwdcfg_conf "$1"
@ -367,4 +387,6 @@ configure_calamares(){
write_services_conf "$1" write_services_conf "$1"
write_users_conf "$1" write_users_conf "$1"
info "Done configuring [Calamares]"
} }

View file

@ -84,24 +84,6 @@ configure_mhwd_drivers(){
fi fi
} }
chroot_clean(){
msg "Cleaning up ..."
for image in "$1"/*-image; do
[[ -d ${image} ]] || continue
local name=${image##*/}
if [[ $name != "mhwd-image" ]];then
msg2 "Deleting chroot [%s] ..." "$name"
lock 9 "${image}.lock" "Locking chroot '${image}'"
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
fi
rm -rf --one-file-system "${image}"
fi
done
exec 9>&-
rm -rf --one-file-system "$1"
}
configure_lsb(){ configure_lsb(){
[[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg [[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg
if [ -e $1/etc/lsb-release ] ; then if [ -e $1/etc/lsb-release ] ; then
@ -191,10 +173,10 @@ detect_desktop_env(){
} }
write_live_session_conf(){ write_live_session_conf(){
msg2 "Configuring live session ..." local path=$1${SYSCONFDIR}
local path=$1${DATADIR}
[[ ! -d $path ]] && mkdir -p $path [[ ! -d $path ]] && mkdir -p $path
local conf=$path/live.conf local conf=$path/live.conf
msg2 "Writing %s" "${conf##*/}"
echo '# live session configuration' > ${conf} echo '# live session configuration' > ${conf}
echo '' >> ${conf} echo '' >> ${conf}
echo '# autologin' >> ${conf} echo '# autologin' >> ${conf}
@ -220,6 +202,9 @@ write_live_session_conf(){
echo '' >> ${conf} echo '' >> ${conf}
echo '# default_desktop_executable' >> ${conf} echo '# default_desktop_executable' >> ${conf}
echo "default_desktop_executable=${default_desktop_executable}" >> ${conf} echo "default_desktop_executable=${default_desktop_executable}" >> ${conf}
echo '' >> ${conf}
echo '# samba workgroup' >> ${conf}
echo "smb_workgroup=${smb_workgroup}" >> ${conf}
} }
configure_hosts(){ configure_hosts(){
@ -257,7 +242,7 @@ configure_live_image(){
configure_mhwd "$1" configure_mhwd "$1"
configure_system "$1" configure_system "$1"
configure_services "$1" configure_services "$1"
configure_calamares "$1" configure_calamares "$1" "$1/etc/mkinitcpio.d/${kernel}.preset"
write_live_session_conf "$1" write_live_session_conf "$1"
msg "Done configuring [live-image]" msg "Done configuring [live-image]"
} }
@ -288,11 +273,29 @@ copy_from_cache(){
} }
chroot_create(){ chroot_create(){
[[ "${1##*/}" == "root-image" ]] && local flag="-L" [[ "${1##*/}" == "root-image" ]] && local flag="-L"
setarch "${target_arch}" \ setarch "${target_arch}" \
mkchroot ${mkchroot_args[*]} ${flag} $@ mkchroot ${mkchroot_args[*]} ${flag} $@
} }
chroot_clean(){
msg "Cleaning up ..."
for image in "$1"/*-image; do
[[ -d ${image} ]] || continue
local name=${image##*/}
if [[ $name != "mhwd-image" ]];then
msg2 "Deleting chroot [%s] ..." "$name"
lock 9 "${image}.lock" "Locking chroot '${image}'"
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
fi
rm -rf --one-file-system "${image}"
fi
done
exec 9>&-
rm -rf --one-file-system "$1"
}
clean_up_image(){ clean_up_image(){
msg2 "Cleaning [%s]" "${1##*/}" msg2 "Cleaning [%s]" "${1##*/}"
@ -306,20 +309,17 @@ clean_up_image(){
if [[ -d $path ]];then if [[ -d $path ]];then
find "$path" -mindepth 0 -delete &> /dev/null find "$path" -mindepth 0 -delete &> /dev/null
fi fi
else else
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.gen.bak" ]] && \ [[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.conf.bak" ]] && \
mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
path=$1/boot path=$1/boot
if [[ -d "$path" ]]; then if [[ -d "$path" ]]; then
find "$path" -name 'initramfs*.img' -delete &> /dev/null find "$path" -name 'initramfs*.img' -delete &> /dev/null
fi fi
# path=$1/var/lib/pacman/sync path=$1/var/lib/pacman/sync
# if [[ -d $path ]];then if [[ -d $path ]];then
# find "$path" -type f -delete &> /dev/null find "$path" -type f -delete &> /dev/null
# fi fi
path=$1/var/cache/pacman/pkg path=$1/var/cache/pacman/pkg
if [[ -d $path ]]; then if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null find "$path" -type f -delete &> /dev/null

85
lib/util-iso-yaml.sh Normal file
View file

@ -0,0 +1,85 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import ${LIBDIR}/util-iso.sh
import ${LIBDIR}/util-iso-calamares.sh
# check_yaml(){
# result=$(python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < $1)
# msg2 "Checking validity [%s] ..." "${1##*/}"
# [[ $? -ne 0 ]] && error "yaml error: %s [msg: %s]" "$1" "${result}"
# }
get_preset(){
local p=${tmp_dir}/${kernel}.preset kvmaj kvmin
cp ${DATADIR}/linux.preset $p
digit=${kernel##linux}
kvmaj=${digit:0:1}
kvmin=${digit:1}
sed -e "s|@kvmaj@|$kvmaj|g" \
-e "s|@kvmin@|$kvmin|g" \
-e "s|@arch@|${target_arch}|g"\
-i $p
echo $p
}
write_calamares_yaml(){
configure_calamares "${yaml_dir}" "$(get_preset)"
# for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
# check_yaml "$conf"
# done
}
write_netgroup_yaml(){
msg2 "Writing %s ..." "${2##*/}"
echo "- name: '$1'" > "$2"
echo " description: '$1'" >> "$2"
echo " selected: false" >> "$2"
echo " hidden: false" >> "$2"
echo " packages:" >> "$2"
for p in ${packages[@]};do
echo " - $p" >> "$2"
done
# check_yaml "$2"
}
prepare_check(){
profile=$1
edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
check_profile
load_profile_config "${profile_dir}/profile.conf"
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
prepare_dir "${yaml_dir}"
chown "${OWNER}:${OWNER}" "${yaml_dir}"
}
gen_fn(){
echo ${yaml_dir}/$1-${target_arch}-${initsys}.yaml
}
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##*/}")"
fi
${calamares} && write_calamares_yaml "$1"
user_own "${yaml_dir}"
reset_profile
unset yaml_dir
}

View file

@ -563,7 +563,7 @@ check_profile(){
[[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd [[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd
if ! ${netinstall};then if ! ${netinstall} && ! ${unpackfs};then
unpackfs="true" unpackfs="true"
fi fi
} }
@ -612,7 +612,7 @@ compress_images(){
make_checksum "${iso_file}" make_checksum "${iso_file}"
${sign} && sign_iso "${iso_file}" ${sign} && sign_iso "${iso_file}"
${torrent} && make_torrent ${torrent} && make_torrent
chown -R "${OWNER}:$(id --group ${OWNER})" "${iso_dir}" user_own "${iso_dir}"
show_elapsed_time "${FUNCNAME}" "${timer}" show_elapsed_time "${FUNCNAME}" "${timer}"
} }

View file

@ -250,7 +250,7 @@ move_to_cache(){
mv $src ${pkg_dir}/ mv $src ${pkg_dir}/
${sign} && sign_pkg "${src##*/}" ${sign} && sign_pkg "${src##*/}"
[[ -n $PKGDEST ]] && rm "$1" [[ -n $PKGDEST ]] && rm "$1"
chown -R "${OWNER}:$(id --group ${OWNER})" "${pkg_dir}" user_own "${pkg_dir}"
} }
archive_logs(){ archive_logs(){

View file

@ -402,7 +402,7 @@ load_profile_config(){
[[ -z ${pxe_boot} ]] && pxe_boot="true" [[ -z ${pxe_boot} ]] && pxe_boot="true"
[[ -z ${plymouth_boot} ]] && plymouth_boot="true" [[ -z ${plymouth_boot} ]] && plymouth_boot="true"
[[ ${initsys} == 'openrc' ]] && plymouth_boot="false" # [[ ${initsys} == 'openrc' ]] && plymouth_boot="false"
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true" [[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
@ -435,11 +435,11 @@ load_profile_config(){
[[ -z ${disable_openrc[@]} ]] && disable_openrc=() [[ -z ${disable_openrc[@]} ]] && disable_openrc=()
if [[ -z ${enable_systemd_live[@]} ]];then if [[ -z ${enable_systemd_live[@]} ]];then
enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init') enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
fi fi
if [[ -z ${enable_openrc_live[@]} ]];then if [[ -z ${enable_openrc_live[@]} ]];then
enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init') enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
fi fi
if [[ ${displaymanager} != "none" ]]; then if [[ ${displaymanager} != "none" ]]; then
@ -457,15 +457,17 @@ load_profile_config(){
[[ -z ${netgroups} ]] && netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinstall" [[ -z ${netgroups} ]] && netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinstall"
if ! ${unpackfs} && ! ${netinstall};then [[ -z ${smb_workgroup} ]] && smb_workgroup=''
netinstall='true'
fi
check_profile_vars check_profile_vars
return 0 return 0
} }
user_own(){
chown -R "${OWNER}:$(id --group ${OWNER})" "$1"
}
clean_dir(){ clean_dir(){
if [[ -d $1 ]]; then if [[ -d $1 ]]; then
msg "Cleaning [%s] ..." "$1" msg "Cleaning [%s] ..." "$1"