forked from mirrored-repos/manjaro-tools
[buildiso] drop unused code; some cosmetics
This commit is contained in:
parent
c0973a0987
commit
bd1f7bf8fa
4 changed files with 55 additions and 87 deletions
|
@ -25,7 +25,6 @@ show_profile(){
|
||||||
load_profile "$1"
|
load_profile "$1"
|
||||||
msg2 "work_dir: ${work_dir}"
|
msg2 "work_dir: ${work_dir}"
|
||||||
msg2 "iso_file: ${iso_file}"
|
msg2 "iso_file: ${iso_file}"
|
||||||
#msg2 "pacman_conf: ${pacman_conf}"
|
|
||||||
msg2 "is_custom_pac_conf: ${is_custom_pac_conf}"
|
msg2 "is_custom_pac_conf: ${is_custom_pac_conf}"
|
||||||
|
|
||||||
msg2 "initsys: ${initsys}"
|
msg2 "initsys: ${initsys}"
|
||||||
|
@ -88,7 +87,6 @@ display_settings(){
|
||||||
msg2 "clean_first: ${clean_first}"
|
msg2 "clean_first: ${clean_first}"
|
||||||
msg2 "clean_cache_xorg: ${clean_cache_xorg}"
|
msg2 "clean_cache_xorg: ${clean_cache_xorg}"
|
||||||
msg2 "clean_cache_lng: ${clean_cache_lng}"
|
msg2 "clean_cache_lng: ${clean_cache_lng}"
|
||||||
msg2 "clean_cache_iso: ${clean_cache_iso}"
|
|
||||||
msg2 "images_only: ${images_only}"
|
msg2 "images_only: ${images_only}"
|
||||||
msg2 "iso_only: ${iso_only}"
|
msg2 "iso_only: ${iso_only}"
|
||||||
|
|
||||||
|
@ -107,6 +105,8 @@ display_settings(){
|
||||||
msg "ISO SETTINGS:"
|
msg "ISO SETTINGS:"
|
||||||
msg2 "iso_label: ${iso_label}"
|
msg2 "iso_label: ${iso_label}"
|
||||||
msg2 "iso_name: ${iso_name}"
|
msg2 "iso_name: ${iso_name}"
|
||||||
|
msg2 "iso_publisher: ${iso_publisher}"
|
||||||
|
msg2 "iso_app_id: ${iso_app_id}"
|
||||||
msg2 "iso_compression: ${iso_compression}"
|
msg2 "iso_compression: ${iso_compression}"
|
||||||
msg2 "iso_checksum: ${iso_checksum}"
|
msg2 "iso_checksum: ${iso_checksum}"
|
||||||
|
|
||||||
|
@ -120,7 +120,6 @@ load_config "${USER_CONFIG}/manjaro-tools.conf"
|
||||||
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
clean_first=true
|
clean_first=true
|
||||||
clean_cache_iso=true
|
|
||||||
|
|
||||||
clean_cache_xorg=false
|
clean_cache_xorg=false
|
||||||
clean_cache_lng=false
|
clean_cache_lng=false
|
||||||
|
@ -137,9 +136,7 @@ usage() {
|
||||||
echo " -a <arch> Arch [default: ${arch}]"
|
echo " -a <arch> Arch [default: ${arch}]"
|
||||||
echo " -b <branch> Branch [default: ${branch}]"
|
echo " -b <branch> Branch [default: ${branch}]"
|
||||||
echo ' -r <dir> Chroots directory'
|
echo ' -r <dir> Chroots directory'
|
||||||
echo ' -k <repo> Custom pacman repo to keep'
|
|
||||||
echo " [default: ${chroots_iso}]"
|
echo " [default: ${chroots_iso}]"
|
||||||
echo ' -w Disable clean iso cache'
|
|
||||||
echo ' -c Disable clean work dir'
|
echo ' -c Disable clean work dir'
|
||||||
echo ' -x Clean xorg cache'
|
echo ' -x Clean xorg cache'
|
||||||
echo ' -l Clean lng cache'
|
echo ' -l Clean lng cache'
|
||||||
|
@ -155,7 +152,7 @@ usage() {
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$@")
|
||||||
|
|
||||||
opts='p:a:b:r:k:cxlisqwLh'
|
opts='p:a:b:r:cxlisqh'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
|
@ -165,7 +162,6 @@ while getopts "${opts}" arg; do
|
||||||
r) chroots_iso="$OPTARG" ;;
|
r) chroots_iso="$OPTARG" ;;
|
||||||
k) keep_repo="$OPTARG" ;;
|
k) keep_repo="$OPTARG" ;;
|
||||||
c) clean_first=false ;;
|
c) clean_first=false ;;
|
||||||
w) clean_cache_iso=false;;
|
|
||||||
x) clean_cache_xorg=true ;;
|
x) clean_cache_xorg=true ;;
|
||||||
l) clean_cache_lng=true ;;
|
l) clean_cache_lng=true ;;
|
||||||
i) images_only=true ;;
|
i) images_only=true ;;
|
||||||
|
@ -190,15 +186,9 @@ cache_dir_iso="${cache_dir}/iso"
|
||||||
|
|
||||||
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
||||||
|
|
||||||
# create_args+=(-v -a ${arch} -D ${iso_name} -M ${mirrors_conf})
|
|
||||||
|
|
||||||
# iso_args+=(-v -x -a ${arch} -D ${iso_name} -L ${iso_label} -c ${iso_compression})
|
|
||||||
|
|
||||||
# ${clean_cache_iso} && iso_args+=(-f)
|
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
check_run_dir
|
#check_run_dir
|
||||||
|
|
||||||
eval_buildset "${buildset_iso}" "${sets_dir_iso}"
|
eval_buildset "${buildset_iso}" "${sets_dir_iso}"
|
||||||
|
|
||||||
|
|
|
@ -338,27 +338,3 @@ configure_xorg_drivers(){
|
||||||
touch $1/var/lib/mhwd/db/pci/graphic_drivers/nvidia-340xx/MHWDCONFIG
|
touch $1/var/lib/mhwd/db/pci/graphic_drivers/nvidia-340xx/MHWDCONFIG
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: image path
|
|
||||||
clean_up_image(){
|
|
||||||
msg2 "Cleaning up [$1]"
|
|
||||||
if [ -d "$1/boot/" ]; then
|
|
||||||
# remove the initcpio images that were generated for the host system
|
|
||||||
find "$1/boot" -name 'initramfs*.img' -delete &>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -f "$1/etc/locale.gen.bak" ]] \
|
|
||||||
&& 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"
|
|
||||||
|
|
||||||
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete &>/dev/null
|
|
||||||
find "$1/var/lib/pacman/sync" -delete &>/dev/null
|
|
||||||
find "$1/var/cache/pacman/pkg" -type f -delete &>/dev/null
|
|
||||||
find "$1/var/log" -type f -delete &>/dev/null
|
|
||||||
find "$1/var/tmp" -mindepth 1 -delete &>/dev/null
|
|
||||||
find "$1/tmp" -mindepth 1 -delete &>/dev/null
|
|
||||||
|
|
||||||
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
[[ -r ${LIBDIR}/util-iso-boot.sh ]] && source ${LIBDIR}/util-iso-boot.sh
|
[[ -r ${LIBDIR}/util-iso-boot.sh ]] && source ${LIBDIR}/util-iso-boot.sh
|
||||||
[[ -r ${LIBDIR}/util-iso-calamares.sh ]] && source ${LIBDIR}/util-iso-calamares.sh
|
[[ -r ${LIBDIR}/util-iso-calamares.sh ]] && source ${LIBDIR}/util-iso-calamares.sh
|
||||||
|
|
||||||
check_run_dir(){
|
# check_run_dir(){
|
||||||
if [[ ! -f shared/Packages-Systemd ]] || [[ ! -f shared/Packages-Openrc ]];then
|
# if [[ ! -f shared/Packages-Systemd ]] || [[ ! -f shared/Packages-Openrc ]];then
|
||||||
die "${0##*/} is not run in a valid iso-profiles folder!"
|
# die "${0##*/} is not run in a valid iso-profiles folder!"
|
||||||
fi
|
# fi
|
||||||
}
|
# }
|
||||||
|
|
||||||
copy_overlay_root(){
|
copy_overlay_root(){
|
||||||
msg2 "Copying overlay ..."
|
msg2 "Copying overlay ..."
|
||||||
|
@ -189,31 +189,8 @@ squash_image_dir() {
|
||||||
msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes"
|
msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes"
|
||||||
}
|
}
|
||||||
|
|
||||||
make_squash(){
|
run_xorriso(){
|
||||||
|
msg "Creating ISO image..."
|
||||||
}
|
|
||||||
|
|
||||||
# Build ISO
|
|
||||||
make_iso() {
|
|
||||||
msg "Start [Build ISO]"
|
|
||||||
touch "${work_dir}/iso/.buildiso"
|
|
||||||
for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do
|
|
||||||
if [[ "$d" != "${work_dir}/iso" ]] && \
|
|
||||||
[[ "$(basename "$d")" != "iso" ]] && \
|
|
||||||
[[ "$(basename "$d")" != "efiboot" ]] && \
|
|
||||||
[[ "$d" != "${work_dir}" ]]; then
|
|
||||||
squash_image_dir "$d" || die "Exit ..."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
msg "Making bootable image"
|
|
||||||
# Sanity checks
|
|
||||||
[[ ! -d "${work_dir}/iso" ]] && die "[${work_dir}/iso] doesn't exist. What did you do?!"
|
|
||||||
|
|
||||||
if [[ -f "${cache_dir_iso}/${iso_file}" ]]; then
|
|
||||||
msg2 "Removing existing bootable image..."
|
|
||||||
rm -rf "${cache_dir_iso}/${iso_file}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local efi_boot_args=""
|
local efi_boot_args=""
|
||||||
if [[ -f "${work_dir}/iso/EFI/miso/${iso_name}.img" ]]; then
|
if [[ -f "${work_dir}/iso/EFI/miso/${iso_name}.img" ]]; then
|
||||||
msg2 "Setting efi args. El Torito detected."
|
msg2 "Setting efi args. El Torito detected."
|
||||||
|
@ -222,13 +199,7 @@ make_iso() {
|
||||||
"-isohybrid-gpt-basdat" \
|
"-isohybrid-gpt-basdat" \
|
||||||
"-no-emul-boot")
|
"-no-emul-boot")
|
||||||
fi
|
fi
|
||||||
msg "Creating ISO image..."
|
|
||||||
# test msg2
|
|
||||||
msg2 "iso_label: ${iso_label}"
|
|
||||||
msg2 "iso_name: ${iso_name}"
|
|
||||||
msg2 "iso_publisher: ${iso_publisher}"
|
|
||||||
msg2 "iso_app_id: ${iso_app_id}"
|
|
||||||
msg2 "iso_file: ${iso_file}"
|
|
||||||
xorriso -as mkisofs \
|
xorriso -as mkisofs \
|
||||||
-iso-level 3 -rock -joliet \
|
-iso-level 3 -rock -joliet \
|
||||||
-max-iso9660-filenames -omit-period \
|
-max-iso9660-filenames -omit-period \
|
||||||
|
@ -245,6 +216,30 @@ make_iso() {
|
||||||
${efi_boot_args[@]} \
|
${efi_boot_args[@]} \
|
||||||
-output "${cache_dir_iso}/${iso_file}" \
|
-output "${cache_dir_iso}/${iso_file}" \
|
||||||
"${work_dir}/iso/"
|
"${work_dir}/iso/"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build ISO
|
||||||
|
make_iso() {
|
||||||
|
msg "Start [Build ISO]"
|
||||||
|
touch "${work_dir}/iso/.buildiso"
|
||||||
|
for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do
|
||||||
|
if [[ "$d" != "${work_dir}/iso" ]] && \
|
||||||
|
[[ "$(basename "$d")" != "iso" ]] && \
|
||||||
|
[[ "$(basename "$d")" != "efiboot" ]] && \
|
||||||
|
[[ "$d" != "${work_dir}" ]]; then
|
||||||
|
squash_image_dir "$d" || die "Exit ..."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
msg "Making bootable image"
|
||||||
|
# Sanity checks
|
||||||
|
[[ ! -d "${work_dir}/iso" ]] && die "[${work_dir}/iso] doesn't exist. What did you do?!"
|
||||||
|
if [[ -f "${cache_dir_iso}/${iso_file}" ]]; then
|
||||||
|
msg2 "Removing existing bootable image..."
|
||||||
|
rm -rf "${cache_dir_iso}/${iso_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
run_xorriso
|
||||||
|
|
||||||
chown -R "${OWNER}:users" "${cache_dir_iso}"
|
chown -R "${OWNER}:users" "${cache_dir_iso}"
|
||||||
msg "Done [Build ISO]"
|
msg "Done [Build ISO]"
|
||||||
|
@ -296,10 +291,22 @@ umount_image_handler(){
|
||||||
aufs_remove_image "${work_dir}/boot-image"
|
aufs_remove_image "${work_dir}/boot-image"
|
||||||
}
|
}
|
||||||
|
|
||||||
# mkiso_error_handler(){
|
# $1: image path
|
||||||
# umount_image_handler
|
clean_up_image(){
|
||||||
# die "Exiting..."
|
msg2 "Cleaning up [$1]"
|
||||||
# }
|
[[ -d "$1/boot/" ]] && find "$1/boot" -name 'initramfs*.img' -delete &>/dev/null
|
||||||
|
[[ -f "$1/etc/locale.gen.bak" ]] && 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"
|
||||||
|
|
||||||
|
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete &>/dev/null
|
||||||
|
find "$1/var/lib/pacman/sync" -delete &>/dev/null
|
||||||
|
find "$1/var/cache/pacman/pkg" -type f -delete &>/dev/null
|
||||||
|
find "$1/var/log" -type f -delete &>/dev/null
|
||||||
|
find "$1/var/tmp" -mindepth 1 -delete &>/dev/null
|
||||||
|
find "$1/tmp" -mindepth 1 -delete &>/dev/null
|
||||||
|
|
||||||
|
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
||||||
|
}
|
||||||
|
|
||||||
# Base installation (root-image)
|
# Base installation (root-image)
|
||||||
make_image_root() {
|
make_image_root() {
|
||||||
|
@ -308,6 +315,7 @@ make_image_root() {
|
||||||
local path="${work_dir}/root-image"
|
local path="${work_dir}/root-image"
|
||||||
mkdir -p ${path}
|
mkdir -p ${path}
|
||||||
make_chroot "${path}" "${packages}"
|
make_chroot "${path}" "${packages}"
|
||||||
|
clean_up_image "${path}"
|
||||||
pacman -Qr "${path}" > "${path}/root-image-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/root-image-pkgs.txt"
|
||||||
configure_lsb "${path}"
|
configure_lsb "${path}"
|
||||||
copy_overlay_root "${path}"
|
copy_overlay_root "${path}"
|
||||||
|
@ -325,6 +333,7 @@ make_image_custom() {
|
||||||
umount_image_handler
|
umount_image_handler
|
||||||
aufs_mount_root_image "${path}"
|
aufs_mount_root_image "${path}"
|
||||||
make_chroot "${path}" "${packages}"
|
make_chroot "${path}" "${packages}"
|
||||||
|
clean_up_image "${path}"
|
||||||
pacman -Qr "${path}" > "${path}/${custom}-image-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/${custom}-image-pkgs.txt"
|
||||||
cp "${path}/${custom}-image-pkgs.txt" ${cache_dir_iso}/${iso_name}-${custom}-${dist_release}-${arch}-pkgs.txt
|
cp "${path}/${custom}-image-pkgs.txt" ${cache_dir_iso}/${iso_name}-${custom}-${dist_release}-${arch}-pkgs.txt
|
||||||
[[ -d ${custom}-overlay ]] && copy_overlay_custom
|
[[ -d ${custom}-overlay ]] && copy_overlay_custom
|
||||||
|
@ -350,6 +359,7 @@ make_image_livecd() {
|
||||||
aufs_mount_root_image "${path}"
|
aufs_mount_root_image "${path}"
|
||||||
fi
|
fi
|
||||||
make_chroot "${path}" "${packages}"
|
make_chroot "${path}" "${packages}"
|
||||||
|
clean_up_image "${path}"
|
||||||
pacman -Qr "${path}" > "${path}/livecd-image-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/livecd-image-pkgs.txt"
|
||||||
copy_overlay_livecd "${path}"
|
copy_overlay_livecd "${path}"
|
||||||
# copy over setup helpers and config loader
|
# copy over setup helpers and config loader
|
||||||
|
|
|
@ -323,14 +323,6 @@ load_config(){
|
||||||
buildset_iso='default'
|
buildset_iso='default'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if [[ -z ${clean_cache_xorg} ]];then
|
|
||||||
# clean_cache_xorg='true'
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# if [[ -z ${clean_cache_lng} ]];then
|
|
||||||
# clean_cache_lng='true'
|
|
||||||
# fi
|
|
||||||
|
|
||||||
##### iso settings #####
|
##### iso settings #####
|
||||||
|
|
||||||
if [[ -z ${dist_release} ]];then
|
if [[ -z ${dist_release} ]];then
|
||||||
|
|
Loading…
Reference in a new issue