Commit 95cef43b authored by udeved's avatar udeved

buildiso: rework overlay copying

parent 49ed39be
......@@ -25,11 +25,20 @@ prepare_build(){
timer_start=$(get_timer)
profile=$1
edition=$(get_edition "${profile}")
profile_dir=${run_dir}/${edition}/${profile}
local profile_dir=${run_dir}/${edition}/${profile}
load_profile "${profile_dir}"
local pacman_conf=$(get_pacman_conf)
local user_conf=${profile_dir}/user-repos.conf pac_arch='default' pacman_conf
[[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib'
if [[ -f ${user_conf} ]];then
info "detected: %s" "user-repos.conf"
check_user_repos_conf "${user_conf}"
pacman_conf=${tmp_dir}/custom-pacman.conf
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$pacman_conf"
else
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
fi
local mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
......
......@@ -9,18 +9,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
copy_overlay(){
local src="$1" dest="$2"
if [[ -e $src ]];then
msg2 "Copying [%s] ..." "${src##*/}"
if [[ -L $src ]];then
cp -a --no-preserve=ownership $src/* $dest
else
cp -LR $src/* $dest
fi
fi
}
add_svc_rc(){
local mnt="$1" name="$2"
if [[ -f $mnt/etc/init.d/$name ]];then
......
......@@ -273,6 +273,14 @@ reset_pac_conf(){
-i "$fs/etc/pacman.conf"
}
copy_overlay(){
local src="$1" dest="$2"
if [[ -e "$src" ]];then
msg2 "Copying [%s] ..." "${src##*/}"
cp -LR "$src"/* "$dest"
fi
}
# Base installation (rootfs)
make_image_root() {
if [[ ! -e ${work_dir}/rootfs.lock ]]; then
......@@ -283,8 +291,9 @@ make_image_root() {
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
copy_overlay "${profile_dir}/root-overlay" "${rootfs}"
# pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
copy_overlay "${root_overlay}" "${rootfs}"
reset_pac_conf "${rootfs}"
......@@ -307,9 +316,11 @@ make_image_desktop() {
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
pacman -Qr "${desktopfs}" > "${desktopfs}/desktopfs-pkgs.txt"
cp "${desktopfs}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${desktopfs}"
# pacman -Qr "${desktopfs}" > "${desktopfs}/desktopfs-pkgs.txt"
# cp "${desktopfs}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
copy_overlay "${desktop_overlay}" "${desktopfs}"
reset_pac_conf "${desktopfs}"
......@@ -331,8 +342,10 @@ make_image_live() {
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
copy_overlay "${profile_dir}/live-overlay" "${livefs}"
# pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
copy_overlay "${live_overlay}" "${livefs}"
configure_live_image "${livefs}"
reset_pac_conf "${livefs}"
......@@ -528,20 +541,6 @@ make_profile(){
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}
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
info "detected: %s" "user-repos.conf"
check_user_repos_conf "${user_conf}"
conf=${tmp_dir}/custom-pacman.conf
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$conf"
else
conf="${DATADIR}/pacman-$pac_arch.conf"
fi
echo "$conf"
}
build(){
local prof="$1"
prepare_build "$prof"
......
......@@ -386,12 +386,27 @@ load_profile(){
${extra} && basic='false'
root_list=${run_dir}/shared/Packages-Root
root_overlay="${run_dir}/shared/${dist_name}/root-overlay"
if [[ -e "$profdir/root-overlay" ]];then
root_overlay="$profdir/root-overlay"
fi
mhwd_list=${run_dir}/shared/Packages-Mhwd
desktop_list=$profdir/Packages-Desktop
if [[ -e "$profdir/desktop-overlay" ]];then
desktop_overlay="$profdir/desktop-overlay"
fi
live_list=$profdir/Packages-Live
live_list="${run_dir}/shared/Packages-Live"
if [[ -f "$profdir/Packages-Live" ]];then
live_list="$profdir/Packages-Live"
fi
live_overlay="${run_dir}/shared/${dist_name}/live-overlay"
if [[ -e "$profdir/live-overlay" ]];then
live_overlay="$profdir/live-overlay"
fi
if ${netinstall};then
sort -u ${run_dir}/shared/Packages-Net ${live_list} > ${tmp_dir}/packages-live-net.list
......@@ -426,15 +441,18 @@ reset_profile(){
unset disable_openrc
unset enable_systemd_live
unset enable_openrc_live
unset root_list
unset desktop_list
unset mhwd_list
unset live_list
unset login_shell
unset netinstall
unset chrootcfg
unset geoip
unset extra
unset root_list
unset desktop_list
unset mhwd_list
unset live_list
unset root_overlay
unset desktop_overlay
unset live_overlay
}
# $1: file name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment