Commit ebdcecf9 authored by udeved's avatar udeved

buildiso: rework pkglist files

parent e47b445e
......@@ -27,8 +27,7 @@ prepare_build(){
edition=$(get_edition "${profile}")
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
load_profile_config "${profile_dir}/profile.conf"
load_profile "${profile_dir}"
local pacman_conf=$(get_pacman_conf)
......
......@@ -20,6 +20,19 @@ SYSCONFDIR='@sysconfdir@'
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-yaml.sh
prepare_check(){
profile="$1"
local edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
load_profile "${profile_dir}"
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
prepare_dir "${yaml_dir}"
user_own "${yaml_dir}"
}
show_profile(){
prepare_check "$1"
msg2 "yaml_dir: %s" "${yaml_dir}"
......
......@@ -93,9 +93,9 @@ configure_lsb(){
}
configure_logind(){
msg2 "Configuring logind ..."
local conf=$1/etc/$2/logind.conf
if [[ -e $conf ]];then
msg2 "Configuring logind ..."
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
......@@ -190,7 +190,7 @@ make_repo(){
clean_iso_root(){
local dest="$1"
msg2 "Deleting isoroot [%s] ..." "${dest##*/}"
msg "Deleting isoroot [%s] ..." "${dest##*/}"
rm -rf --one-file-system "$dest"
}
......
......@@ -199,16 +199,14 @@ make_sfs() {
assemble_iso(){
msg "Creating ISO image..."
local iso_publisher="$(get_osname) <$(get_disturl)>" \
iso_app_id="$(get_osname) Live/Rescue CD" \
mod_date=$(date -u +%Y-%m-%d-%H-%M-%S-00 | sed -e s/-//g)
local mod_date=$(date -u +%Y-%m-%d-%H-%M-%S-00 | sed -e s/-//g)
xorriso -as mkisofs \
--modification-date=${mod_date} \
--protective-msdos-label \
-volid "${iso_label}" \
-appid "${iso_app_id}" \
-publisher "${iso_publisher}" \
-appid "$(get_osname) Live/Rescue CD" \
-publisher "$(get_osname) <$(get_disturl)>" \
-preparer "Prepared by manjaro-tools/${0##*/}" \
-r -graft-points -no-pad \
--sort-weight 0 / \
......@@ -464,17 +462,17 @@ compress_images(){
prepare_images(){
local timer=$(get_timer)
load_pkgs "${profile_dir}/Packages-Root"
load_pkgs "${root_list}"
run_safe "make_image_root"
if [[ -f "${desktop_list}" ]] ; then
load_pkgs "${desktop_list}"
run_safe "make_image_desktop"
fi
if [[ -f ${profile_dir}/Packages-Live ]]; then
load_pkgs "${profile_dir}/Packages-Live"
if [[ -f ${live_list} ]]; then
load_pkgs "${live_list}"
run_safe "make_image_live"
fi
if [[ -f ${mhwd_list} ]] ; then
if ! ${netinstall} ; then
load_pkgs "${mhwd_list}"
run_safe "make_image_mhwd"
fi
......
......@@ -404,26 +404,13 @@ write_pacman_group_yaml(){
user_own "${cache_dir_netinstall}/pacman" "-R"
}
prepare_check(){
profile=$1
local edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
load_profile_config "${profile_dir}/profile.conf"
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
prepare_dir "${yaml_dir}"
user_own "${yaml_dir}"
}
gen_fn(){
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
}
make_profile_yaml(){
prepare_check "$1"
load_pkgs "${profile_dir}/Packages-Root"
load_pkgs "${root_list}"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
if [[ -f "${desktop_list}" ]]; then
load_pkgs "${desktop_list}"
......
......@@ -193,14 +193,14 @@ init_buildpkg(){
cache_dir_pkg=${cache_dir}/pkg
}
get_iso_label(){
local label="$1"
label="${label//_}" # relace all _
label="${label//-}" # relace all -
label="${label^^}" # all uppercase
label="${label::8}" # limit to 8 characters
echo ${label}
}
# get_iso_label(){
# local label="$1"
# label="${label//_}" # relace all _
# label="${label//-}" # relace all -
# label="${label^^}" # all uppercase
# label="${label::8}" # limit to 8 characters
# echo ${label}
# }
get_codename(){
source /etc/lsb-release
......@@ -262,7 +262,8 @@ init_buildiso(){
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
iso_label=$(get_iso_label "${dist_branding}${dist_release//.}")
# iso_label=$(get_iso_label "${dist_branding}${dist_release//.}")
iso_label="${dist_branding}${dist_release//.}"
[[ -z ${initsys} ]] && initsys="systemd"
......@@ -313,11 +314,18 @@ load_config(){
return 0
}
load_profile_config(){
load_profile(){
[[ -f $1 ]] || return 1
local prof="$1"
[[ -f $prof ]] || return 1
profile_conf="$prof/profile.conf"
profile_conf="$1"
root_list=$prof/Packages-Root
mhwd_list=${run_dir}/shared/Packages-Mhwd
desktop_list=$prof/Packages-Desktop
live_list=$prof/Packages-Live
[[ -r ${profile_conf} ]] && source ${profile_conf}
......@@ -384,6 +392,13 @@ load_profile_config(){
${extra} && basic='false'
if ${netinstall};then
sort -u ${run_dir}/shared/Packages-Net ${live_list} > ${tmp_dir}/packages-live-net.list
live_list=${tmp_dir}/packages-live-net.list
else
chrootcfg="false"
fi
return 0
}
......@@ -410,8 +425,10 @@ 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
......@@ -419,43 +436,6 @@ reset_profile(){
unset extra
}
check_profile(){
local keyfiles=("$1/Packages-Root"
"$1/Packages-Live")
local keydirs=("$1/root-overlay"
"$1/live-overlay")
local has_keyfiles=false has_keydirs=false
for f in ${keyfiles[@]}; do
if [[ -f $f ]];then
has_keyfiles=true
else
has_keyfiles=false
break
fi
done
for d in ${keydirs[@]}; do
if [[ -d $d ]];then
has_keydirs=true
else
has_keydirs=false
break
fi
done
if ! ${has_keyfiles} && ! ${has_keydirs};then
die "Profile [%s] sanity check failed!" "$1"
fi
[[ -f "$1/Packages-Desktop" ]] && desktop_list=$1/Packages-Desktop
[[ -f "$1/Packages-Mhwd" ]] && mhwd_list=$1/Packages-Mhwd
if ! ${netinstall}; then
chrootcfg="false"
fi
}
# $1: file name
load_pkgs(){
info "Loading Packages: [%s] ..." "${1##*/}"
......
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