forked from mirrored-repos/manjaro-tools
buildiso: rework overlay copying
This commit is contained in:
parent
49ed39be2a
commit
95cef43bc7
4 changed files with 54 additions and 40 deletions
|
@ -25,11 +25,20 @@ prepare_build(){
|
||||||
timer_start=$(get_timer)
|
timer_start=$(get_timer)
|
||||||
profile=$1
|
profile=$1
|
||||||
edition=$(get_edition "${profile}")
|
edition=$(get_edition "${profile}")
|
||||||
profile_dir=${run_dir}/${edition}/${profile}
|
local profile_dir=${run_dir}/${edition}/${profile}
|
||||||
|
|
||||||
load_profile "${profile_dir}"
|
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}")
|
local mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,6 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# 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(){
|
add_svc_rc(){
|
||||||
local mnt="$1" name="$2"
|
local mnt="$1" name="$2"
|
||||||
if [[ -f $mnt/etc/init.d/$name ]];then
|
if [[ -f $mnt/etc/init.d/$name ]];then
|
||||||
|
|
|
@ -273,6 +273,14 @@ reset_pac_conf(){
|
||||||
-i "$fs/etc/pacman.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)
|
# Base installation (rootfs)
|
||||||
make_image_root() {
|
make_image_root() {
|
||||||
if [[ ! -e ${work_dir}/rootfs.lock ]]; then
|
if [[ ! -e ${work_dir}/rootfs.lock ]]; then
|
||||||
|
@ -283,8 +291,9 @@ make_image_root() {
|
||||||
|
|
||||||
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
|
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
|
||||||
|
|
||||||
pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
|
# pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
|
||||||
copy_overlay "${profile_dir}/root-overlay" "${rootfs}"
|
|
||||||
|
copy_overlay "${root_overlay}" "${rootfs}"
|
||||||
|
|
||||||
reset_pac_conf "${rootfs}"
|
reset_pac_conf "${rootfs}"
|
||||||
|
|
||||||
|
@ -307,9 +316,11 @@ make_image_desktop() {
|
||||||
|
|
||||||
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
|
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
|
||||||
|
|
||||||
pacman -Qr "${desktopfs}" > "${desktopfs}/desktopfs-pkgs.txt"
|
# 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}"
|
# cp "${desktopfs}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
||||||
|
|
||||||
|
copy_overlay "${desktop_overlay}" "${desktopfs}"
|
||||||
|
|
||||||
reset_pac_conf "${desktopfs}"
|
reset_pac_conf "${desktopfs}"
|
||||||
|
|
||||||
|
@ -331,8 +342,10 @@ make_image_live() {
|
||||||
|
|
||||||
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
|
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
|
||||||
|
|
||||||
pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
|
# pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
|
||||||
copy_overlay "${profile_dir}/live-overlay" "${livefs}"
|
|
||||||
|
copy_overlay "${live_overlay}" "${livefs}"
|
||||||
|
|
||||||
configure_live_image "${livefs}"
|
configure_live_image "${livefs}"
|
||||||
|
|
||||||
reset_pac_conf "${livefs}"
|
reset_pac_conf "${livefs}"
|
||||||
|
@ -528,20 +541,6 @@ make_profile(){
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
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(){
|
build(){
|
||||||
local prof="$1"
|
local prof="$1"
|
||||||
prepare_build "$prof"
|
prepare_build "$prof"
|
||||||
|
|
28
lib/util.sh
28
lib/util.sh
|
@ -386,12 +386,27 @@ load_profile(){
|
||||||
${extra} && basic='false'
|
${extra} && basic='false'
|
||||||
|
|
||||||
root_list=${run_dir}/shared/Packages-Root
|
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
|
mhwd_list=${run_dir}/shared/Packages-Mhwd
|
||||||
|
|
||||||
desktop_list=$profdir/Packages-Desktop
|
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
|
if ${netinstall};then
|
||||||
sort -u ${run_dir}/shared/Packages-Net ${live_list} > ${tmp_dir}/packages-live-net.list
|
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 disable_openrc
|
||||||
unset enable_systemd_live
|
unset enable_systemd_live
|
||||||
unset enable_openrc_live
|
unset enable_openrc_live
|
||||||
unset root_list
|
|
||||||
unset desktop_list
|
|
||||||
unset mhwd_list
|
|
||||||
unset live_list
|
|
||||||
unset login_shell
|
unset login_shell
|
||||||
unset netinstall
|
unset netinstall
|
||||||
unset chrootcfg
|
unset chrootcfg
|
||||||
unset geoip
|
unset geoip
|
||||||
unset extra
|
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
|
# $1: file name
|
||||||
|
|
Loading…
Reference in a new issue