forked from mirrored-repos/manjaro-tools
Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.14.x
This commit is contained in:
commit
bcf85e65f1
12 changed files with 184 additions and 132 deletions
25
Makefile
25
Makefile
|
@ -187,13 +187,22 @@ install_iso:
|
||||||
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
|
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
|
||||||
install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
|
install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
|
||||||
|
|
||||||
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
|
# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
|
||||||
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
|
# install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
|
||||||
|
#
|
||||||
|
# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install
|
||||||
|
# install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install
|
||||||
|
|
||||||
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install
|
# install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio
|
||||||
install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install
|
|
||||||
|
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks
|
||||||
|
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks
|
||||||
|
|
||||||
|
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/install
|
||||||
|
install -m0755 ${CPIOINST} $(DESTDIR)$(SYSCONFDIR)/initcpio/install
|
||||||
|
|
||||||
|
install -m0755 ${CPIO} $(DESTDIR)$(SYSCONFDIR)/initcpio
|
||||||
|
|
||||||
install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio
|
|
||||||
|
|
||||||
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
|
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
|
||||||
install -m0644 ${SHARED_ISO} $(DESTDIR)$(PREFIX)/share/manjaro-tools
|
install -m0644 ${SHARED_ISO} $(DESTDIR)$(PREFIX)/share/manjaro-tools
|
||||||
|
@ -241,9 +250,9 @@ uninstall_iso:
|
||||||
for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
|
for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
|
||||||
|
|
||||||
for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
|
for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
|
||||||
for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/$$f; done
|
for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks/$$f; done
|
||||||
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/$$f; done
|
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/install/$$f; done
|
||||||
for f in ${CPIO}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/$$f; done
|
for f in ${CPIO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/$$f; done
|
||||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz
|
||||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/deployiso.1.gz
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/deployiso.1.gz
|
||||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz
|
||||||
|
|
|
@ -90,7 +90,6 @@ display_settings(){
|
||||||
msg2 "images_only: %s" "${images_only}"
|
msg2 "images_only: %s" "${images_only}"
|
||||||
msg2 "iso_only: %s" "${iso_only}"
|
msg2 "iso_only: %s" "${iso_only}"
|
||||||
msg2 "persist: %s" "${persist}"
|
msg2 "persist: %s" "${persist}"
|
||||||
# msg2 "sign: %s" "${sign}"
|
|
||||||
msg2 "torrent: %s" "${torrent}"
|
msg2 "torrent: %s" "${torrent}"
|
||||||
|
|
||||||
msg "DIST SETTINGS:"
|
msg "DIST SETTINGS:"
|
||||||
|
@ -123,7 +122,6 @@ pretend=false
|
||||||
images_only=false
|
images_only=false
|
||||||
iso_only=false
|
iso_only=false
|
||||||
verbose=false
|
verbose=false
|
||||||
# sign=false
|
|
||||||
torrent=false
|
torrent=false
|
||||||
persist=false
|
persist=false
|
||||||
|
|
||||||
|
@ -141,7 +139,6 @@ usage() {
|
||||||
echo ' -i <name> Init system to use'
|
echo ' -i <name> Init system to use'
|
||||||
echo " [default: ${initsys}]"
|
echo " [default: ${initsys}]"
|
||||||
echo ' -m Set SquashFS image mode to persistence'
|
echo ' -m Set SquashFS image mode to persistence'
|
||||||
# echo ' -s Sign the sfs images'
|
|
||||||
echo ' -c Disable clean work dir'
|
echo ' -c Disable clean work dir'
|
||||||
echo ' -x Build images only'
|
echo ' -x Build images only'
|
||||||
echo ' -z Generate iso only'
|
echo ' -z Generate iso only'
|
||||||
|
@ -168,7 +165,6 @@ while getopts "${opts}" arg; do
|
||||||
t) cache_dir_iso="$OPTARG" ;;
|
t) cache_dir_iso="$OPTARG" ;;
|
||||||
k) kernel="$OPTARG" ;;
|
k) kernel="$OPTARG" ;;
|
||||||
i) initsys="$OPTARG" ;;
|
i) initsys="$OPTARG" ;;
|
||||||
# s) sign=true ;;
|
|
||||||
c) clean_first=false ;;
|
c) clean_first=false ;;
|
||||||
x) images_only=true ;;
|
x) images_only=true ;;
|
||||||
z) iso_only=true ;;
|
z) iso_only=true ;;
|
||||||
|
|
|
@ -87,7 +87,7 @@ else
|
||||||
|
|
||||||
${pretend} && display_settings && exit 1
|
${pretend} && display_settings && exit 1
|
||||||
|
|
||||||
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
|
chroot_api_efi_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
|
||||||
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
|
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
################ buildiso ################
|
################ buildiso ################
|
||||||
|
|
||||||
# the name of the profiles directory
|
# the name of the profiles directory
|
||||||
# profile_repo='manjaro-tools-iso-profiles'
|
# profile_repo='iso-profiles'
|
||||||
|
|
||||||
# default iso build list; name without .list extension
|
# default iso build list; name without .list extension
|
||||||
# build_list_iso=default
|
# build_list_iso=default
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
# netinstall="false"
|
# netinstall="false"
|
||||||
|
|
||||||
# the default url for the netinstall.yaml
|
# the default url for the netinstall.yaml
|
||||||
# netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
|
# netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
|
||||||
|
|
||||||
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
|
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
|
||||||
# chrootcfg="false"
|
# chrootcfg="false"
|
||||||
|
|
|
@ -5,7 +5,7 @@ build() {
|
||||||
|
|
||||||
add_runscript
|
add_runscript
|
||||||
|
|
||||||
add_file /usr/lib/initcpio/miso_shutdown /shutdown
|
add_file /etc/initcpio/miso_shutdown /shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
|
|
@ -36,27 +36,23 @@ gen_boot_args(){
|
||||||
|
|
||||||
prepare_initcpio(){
|
prepare_initcpio(){
|
||||||
msg2 "Copying initcpio ..."
|
msg2 "Copying initcpio ..."
|
||||||
cp /usr/lib/initcpio/hooks/miso* $1/etc/initcpio/hooks
|
cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks
|
||||||
cp /usr/lib/initcpio/install/miso* $1/etc/initcpio/install
|
cp /etc/initcpio/install/miso* $1/etc/initcpio/install
|
||||||
cp /usr/lib/initcpio/miso_shutdown $1/etc/initcpio
|
cp /etc/initcpio/miso_shutdown $1/etc/initcpio
|
||||||
sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown
|
# sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_boot_initramfs(){
|
prepare_initramfs(){
|
||||||
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
|
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
|
||||||
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
|
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
|
||||||
}
|
local _kernver=$(cat $2/usr/lib/modules/*/version)
|
||||||
|
chroot-run $2 \
|
||||||
# $1: work_dir
|
|
||||||
gen_boot_image(){
|
|
||||||
local _kernver=$(cat $1/usr/lib/modules/*/version)
|
|
||||||
chroot-run $1 \
|
|
||||||
/usr/bin/mkinitcpio -k ${_kernver} \
|
/usr/bin/mkinitcpio -k ${_kernver} \
|
||||||
-c /etc/mkinitcpio-${iso_name}.conf \
|
-c /etc/mkinitcpio-${iso_name}.conf \
|
||||||
-g /boot/initramfs.img
|
-g /boot/initramfs.img
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_boot_extra(){
|
prepare_boot_extras(){
|
||||||
cp $1/boot/intel-ucode.img $2/intel_ucode.img
|
cp $1/boot/intel-ucode.img $2/intel_ucode.img
|
||||||
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
|
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
|
||||||
cp $1/boot/memtest86+/memtest.bin $2/memtest
|
cp $1/boot/memtest86+/memtest.bin $2/memtest
|
||||||
|
|
|
@ -20,6 +20,26 @@ copy_overlay(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
track_img() {
|
||||||
|
info "mount: [%s]" "$2"
|
||||||
|
mount "$@" && IMG_ACTIVE_MOUNTS=("$2" "${IMG_ACTIVE_MOUNTS[@]}")
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_img() {
|
||||||
|
IMG_ACTIVE_MOUNTS=()
|
||||||
|
mkdir -p "$2"
|
||||||
|
track_img "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_img() {
|
||||||
|
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then
|
||||||
|
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
|
||||||
|
umount "${IMG_ACTIVE_MOUNTS[@]}"
|
||||||
|
unset IMG_ACTIVE_MOUNTS
|
||||||
|
rm -r "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
configure_plymouth(){
|
configure_plymouth(){
|
||||||
if ${plymouth_boot};then
|
if ${plymouth_boot};then
|
||||||
msg2 "Configuring plymouth: %s" "${plymouth_theme}"
|
msg2 "Configuring plymouth: %s" "${plymouth_theme}"
|
||||||
|
@ -194,6 +214,29 @@ configure_system(){
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_thus(){
|
||||||
|
msg2 "Configuring Thus ..."
|
||||||
|
source "$1/etc/mkinitcpio.d/${kernel}.preset"
|
||||||
|
local conf="$1/etc/thus.conf"
|
||||||
|
echo "[distribution]" > "$conf"
|
||||||
|
echo "DISTRIBUTION_NAME = \"${dist_name} Linux\"" >> "$conf"
|
||||||
|
echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf"
|
||||||
|
echo "SHORT_NAME = \"${dist_name}\"" >> "$conf"
|
||||||
|
echo "[install]" >> "$conf"
|
||||||
|
echo "LIVE_MEDIA_SOURCE = \"/bootmnt/${iso_name}/${target_arch}/root-image.sfs\"" >> "$conf"
|
||||||
|
echo "LIVE_MEDIA_DESKTOP = \"/bootmnt/${iso_name}/${target_arch}/desktop-image.sfs\"" >> "$conf"
|
||||||
|
echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf"
|
||||||
|
echo "LIVE_USER_NAME = \"${username}\"" >> "$conf"
|
||||||
|
echo "KERNEL = \"${kernel}\"" >> "$conf"
|
||||||
|
echo "VMLINUZ = \"$(echo ${ALL_kver} | sed s'|/boot/||')\"" >> "$conf"
|
||||||
|
echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf"
|
||||||
|
echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf"
|
||||||
|
|
||||||
|
if [[ -f $1/usr/share/applications/thus.desktop && -f $1/usr/bin/kdesu ]];then
|
||||||
|
sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/thus.desktop
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
configure_live_image(){
|
configure_live_image(){
|
||||||
msg "Configuring [livefs]"
|
msg "Configuring [livefs]"
|
||||||
configure_hosts "$1"
|
configure_hosts "$1"
|
||||||
|
@ -201,7 +244,9 @@ configure_live_image(){
|
||||||
configure_mhwd "$1"
|
configure_mhwd "$1"
|
||||||
configure_system "$1"
|
configure_system "$1"
|
||||||
configure_services "$1"
|
configure_services "$1"
|
||||||
|
configure_plymouth "$1"
|
||||||
configure_calamares "$1"
|
configure_calamares "$1"
|
||||||
|
[[ ${edition} == "sonar" ]] && configure_thus "$1"
|
||||||
write_live_session_conf "$1"
|
write_live_session_conf "$1"
|
||||||
msg "Done configuring [livefs]"
|
msg "Done configuring [livefs]"
|
||||||
}
|
}
|
||||||
|
|
122
lib/util-iso.sh
122
lib/util-iso.sh
|
@ -23,6 +23,7 @@ error_function() {
|
||||||
plain "Aborting..."
|
plain "Aborting..."
|
||||||
fi
|
fi
|
||||||
umount_image
|
umount_image
|
||||||
|
umount_img
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,38 +68,11 @@ trap_exit() {
|
||||||
kill "-$sig" "$$"
|
kill "-$sig" "$$"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_img() {
|
make_sig () {
|
||||||
mkdir -p "$2"
|
msg2 "Creating signature file..."
|
||||||
info "mount: [%s]" "$1"
|
cd "$1"
|
||||||
mount "$1" "$2"
|
gpg --detach-sign --default-key ${gpg_key} $2.sfs
|
||||||
}
|
cd ${OLDPWD}
|
||||||
|
|
||||||
umount_img() {
|
|
||||||
info "umount: [%s]" "$1"
|
|
||||||
umount -d "$1"
|
|
||||||
rm -r "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_ext4_img(){
|
|
||||||
local size=32G
|
|
||||||
local src="$1"
|
|
||||||
local name=${src##*/}
|
|
||||||
local mnt="${mnt_dir}/${name}"
|
|
||||||
msg2 "Creating ext4 image of %s ..." "${size}"
|
|
||||||
truncate -s ${size} "${src}.img"
|
|
||||||
local ext4_args=()
|
|
||||||
${verbose} && ext4_args+=(-q)
|
|
||||||
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
|
|
||||||
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
|
|
||||||
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
|
|
||||||
mount_img "${work_dir}/${name}.img" "${mnt}"
|
|
||||||
msg2 "Copying %s ..." "${src}/"
|
|
||||||
cp -aT "${src}/" "${mnt}/"
|
|
||||||
umount_img "${mnt}"
|
|
||||||
}
|
|
||||||
|
|
||||||
sign_iso(){
|
|
||||||
su ${OWNER} -c "signfile ${iso_dir}/$1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: file
|
# $1: file
|
||||||
|
@ -134,7 +108,22 @@ make_sfs() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${persist} && prepare_ext4_img "${src}"
|
if ${persist};then
|
||||||
|
local size=32G
|
||||||
|
local mnt="${mnt_dir}/${name}"
|
||||||
|
msg2 "Creating ext4 image of %s ..." "${size}"
|
||||||
|
truncate -s ${size} "${src}.img"
|
||||||
|
local ext4_args=()
|
||||||
|
${verbose} && ext4_args+=(-q)
|
||||||
|
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
|
||||||
|
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
|
||||||
|
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
|
||||||
|
mount_img "${work_dir}/${name}.img" "${mnt}"
|
||||||
|
msg2 "Copying %s ..." "${src}/"
|
||||||
|
cp -aT "${src}/" "${mnt}/"
|
||||||
|
umount_img "${mnt}"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
msg2 "Creating SquashFS image, this may take some time..."
|
msg2 "Creating SquashFS image, this may take some time..."
|
||||||
local used_kernel=${kernel:5:1} mksfs_args=()
|
local used_kernel=${kernel:5:1} mksfs_args=()
|
||||||
|
@ -271,7 +260,7 @@ make_image_desktop() {
|
||||||
|
|
||||||
pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt"
|
||||||
cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
||||||
[[ -e ${profile_dir}/${profile}-overlay ]] && copy_overlay "${profile_dir}/${profile}-overlay" "${path}"
|
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${path}"
|
||||||
|
|
||||||
reset_pac_conf "${path}"
|
reset_pac_conf "${path}"
|
||||||
|
|
||||||
|
@ -283,7 +272,7 @@ make_image_desktop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_image_select(){
|
mount_image_select(){
|
||||||
if [[ -f "${packages_custom}" ]]; then
|
if [[ -f "${packages_desktop}" ]]; then
|
||||||
mount_image_custom "$1"
|
mount_image_custom "$1"
|
||||||
else
|
else
|
||||||
mount_image "$1"
|
mount_image "$1"
|
||||||
|
@ -356,14 +345,21 @@ make_image_boot() {
|
||||||
mkdir -p ${path}
|
mkdir -p ${path}
|
||||||
|
|
||||||
mount_image_live "${path}"
|
mount_image_live "${path}"
|
||||||
configure_plymouth "${path}"
|
|
||||||
|
|
||||||
gen_boot_initramfs "${profile_dir}" "${path}"
|
# if [[ ${gpg_key} ]]; then
|
||||||
|
# gpg --export ${gpg_key} >${work_dir}/gpgkey
|
||||||
|
# exec 17<>${work_dir}/gpgkey
|
||||||
|
# fi
|
||||||
|
# MISO_GNUPG_FD=${gpg_key:+17}
|
||||||
|
|
||||||
gen_boot_image "${path}"
|
prepare_initramfs "${profile_dir}" "${path}"
|
||||||
|
|
||||||
|
# if [[ ${gpg_key} ]]; then
|
||||||
|
# exec 17<&-
|
||||||
|
# fi
|
||||||
|
|
||||||
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
|
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
|
||||||
copy_boot_extra "${path}" "${boot}"
|
prepare_boot_extras "${path}" "${boot}"
|
||||||
|
|
||||||
umount_image
|
umount_image
|
||||||
|
|
||||||
|
@ -383,22 +379,6 @@ make_efi_usb() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_fat_img(){
|
|
||||||
local size=31M
|
|
||||||
local src="$1"
|
|
||||||
local mnt="${mnt_dir}/efiboot"
|
|
||||||
local img="${src}/efiboot.img"
|
|
||||||
${pxe_boot} && size=40M
|
|
||||||
msg2 "Creating fat image of %s ..." "${size}"
|
|
||||||
truncate -s ${size} "${img}"
|
|
||||||
mkfs.fat -n MISO_EFI "${img}" &>/dev/null
|
|
||||||
mkdir -p "${mnt}"
|
|
||||||
mount_img "${img}" "${mnt}"
|
|
||||||
prepare_efiboot_image "${mnt}" "${iso_root}"
|
|
||||||
prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd"
|
|
||||||
umount_img "${mnt}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
|
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
|
||||||
make_efi_dvd() {
|
make_efi_dvd() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||||
|
@ -406,7 +386,17 @@ make_efi_dvd() {
|
||||||
local src="${iso_root}/EFI/miso"
|
local src="${iso_root}/EFI/miso"
|
||||||
mkdir -p "${src}"
|
mkdir -p "${src}"
|
||||||
|
|
||||||
prepare_fat_img "${src}"
|
local size=31M
|
||||||
|
local mnt="${mnt_dir}/efiboot" img="${src}/efiboot.img"
|
||||||
|
${pxe_boot} && size=40M
|
||||||
|
msg2 "Creating fat image of %s ..." "${size}"
|
||||||
|
truncate -s ${size} "${img}"
|
||||||
|
mkfs.fat -n MISO_EFI "${img}" &>/dev/null
|
||||||
|
mkdir -p "${mnt}"
|
||||||
|
mount_img "${img}" "${mnt}"
|
||||||
|
prepare_efiboot_image "${mnt}" "${iso_root}"
|
||||||
|
prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd"
|
||||||
|
umount_img "${mnt}"
|
||||||
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/build.${FUNCNAME}
|
||||||
msg "Done [/efiboot/EFI]"
|
msg "Done [/efiboot/EFI]"
|
||||||
|
@ -482,12 +472,24 @@ compress_images(){
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer}"
|
show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# prepare_boot_loaders(){
|
||||||
|
# local timer=$(get_timer)
|
||||||
|
# run_safe "make_image_boot"
|
||||||
|
# run_safe "make_isolinux"
|
||||||
|
# run_safe "make_syslinux"
|
||||||
|
# if [[ "${target_arch}" == "x86_64" ]]; then
|
||||||
|
# run_safe "make_efi_usb"
|
||||||
|
# run_safe "make_efi_dvd"
|
||||||
|
# fi
|
||||||
|
# show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||||
|
# }
|
||||||
|
|
||||||
prepare_images(){
|
prepare_images(){
|
||||||
local timer=$(get_timer)
|
local timer=$(get_timer)
|
||||||
load_pkgs "${profile_dir}/Packages-Root"
|
load_pkgs "${profile_dir}/Packages-Root"
|
||||||
run_safe "make_image_root"
|
run_safe "make_image_root"
|
||||||
if [[ -f "${packages_custom}" ]] ; then
|
if [[ -f "${packages_desktop}" ]] ; then
|
||||||
load_pkgs "${packages_custom}"
|
load_pkgs "${packages_desktop}"
|
||||||
run_safe "make_image_desktop"
|
run_safe "make_image_desktop"
|
||||||
fi
|
fi
|
||||||
if [[ -f ${profile_dir}/Packages-Live ]]; then
|
if [[ -f ${profile_dir}/Packages-Live ]]; then
|
||||||
|
@ -526,6 +528,10 @@ make_profile(){
|
||||||
${verbose} && archive_logs
|
${verbose} && archive_logs
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# if ${boot_only}; then
|
||||||
|
# prepare_boot_loaders
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
if ${images_only}; then
|
if ${images_only}; then
|
||||||
prepare_images
|
prepare_images
|
||||||
${verbose} && archive_logs
|
${verbose} && archive_logs
|
||||||
|
|
|
@ -108,8 +108,8 @@ chroot_mount_partitions(){
|
||||||
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
|
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
|
||||||
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
||||||
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
||||||
# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
|
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
|
||||||
# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
|
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
|
||||||
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
||||||
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
||||||
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
||||||
|
@ -130,6 +130,23 @@ chroot_mount_conditional() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chroot_api_efi_mount() {
|
||||||
|
CHROOT_ACTIVE_MOUNTS=()
|
||||||
|
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
|
||||||
|
trap 'chroot_api_efi_umount' EXIT
|
||||||
|
|
||||||
|
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
|
||||||
|
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
||||||
|
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
||||||
|
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
|
||||||
|
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
|
||||||
|
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
||||||
|
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
||||||
|
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
||||||
|
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
|
||||||
|
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
|
||||||
|
}
|
||||||
|
|
||||||
chroot_api_mount() {
|
chroot_api_mount() {
|
||||||
CHROOT_ACTIVE_MOUNTS=()
|
CHROOT_ACTIVE_MOUNTS=()
|
||||||
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
|
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
|
||||||
|
@ -138,8 +155,6 @@ chroot_api_mount() {
|
||||||
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
|
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
|
||||||
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
||||||
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
||||||
# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
|
|
||||||
# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
|
|
||||||
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
||||||
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
||||||
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
||||||
|
@ -159,6 +174,12 @@ chroot_api_umount() {
|
||||||
unset CHROOT_ACTIVE_MOUNTS
|
unset CHROOT_ACTIVE_MOUNTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chroot_api_efi_umount() {
|
||||||
|
#info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
|
||||||
|
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
|
||||||
|
unset CHROOT_ACTIVE_MOUNTS
|
||||||
|
}
|
||||||
|
|
||||||
trap_handler(){
|
trap_handler(){
|
||||||
chroot_api_umount
|
chroot_api_umount
|
||||||
chroot_part_umount
|
chroot_part_umount
|
||||||
|
|
|
@ -135,7 +135,7 @@ write_unpack_conf(){
|
||||||
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
||||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||||
echo " destination: \"\"" >> "$conf"
|
echo " destination: \"\"" >> "$conf"
|
||||||
if [[ -f "${packages_custom}" ]] ; then
|
if [[ -f "${packages_desktop}" ]] ; then
|
||||||
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
||||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||||
echo " destination: \"\"" >> "$conf"
|
echo " destination: \"\"" >> "$conf"
|
||||||
|
@ -152,9 +152,11 @@ write_users_conf(){
|
||||||
echo " - $g" >> "$conf"
|
echo " - $g" >> "$conf"
|
||||||
done
|
done
|
||||||
unset IFS
|
unset IFS
|
||||||
echo "autologinGroup: autologin" >> "$conf"
|
echo "autologinGroup: autologin" >> "$conf"
|
||||||
echo "sudoersGroup: wheel" >> "$conf"
|
echo "doAutologin: ${autologin}" >> "$conf"
|
||||||
echo "setRootPassword: true" >> "$conf"
|
echo "sudoersGroup: wheel" >> "$conf"
|
||||||
|
echo "setRootPassword: false" >> "$conf"
|
||||||
|
echo "availableShells: /bin/bash, /bin/zsh" >> "$conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_packages_conf(){
|
write_packages_conf(){
|
||||||
|
@ -173,7 +175,7 @@ write_welcome_conf(){
|
||||||
echo "showReleaseNotesUrl: true" >> "$conf"
|
echo "showReleaseNotesUrl: true" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo "requirements:" >> "$conf"
|
echo "requirements:" >> "$conf"
|
||||||
echo " requiredStorage: 5.5" >> "$conf"
|
echo " requiredStorage: 7.9" >> "$conf"
|
||||||
echo " requiredRam: 1.0" >> "$conf"
|
echo " requiredRam: 1.0" >> "$conf"
|
||||||
echo " check:" >> "$conf"
|
echo " check:" >> "$conf"
|
||||||
echo " - storage" >> "$conf"
|
echo " - storage" >> "$conf"
|
||||||
|
@ -211,7 +213,7 @@ write_mhwdcfg_conf(){
|
||||||
echo "driver: ${drv}" >> "$conf"
|
echo "driver: ${drv}" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
local switch='true'
|
local switch='true'
|
||||||
${chrootcfg} && switch='false'
|
${netinstall} && switch='false'
|
||||||
echo "local: ${switch}" >> "$conf"
|
echo "local: ${switch}" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
|
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
|
||||||
|
@ -232,18 +234,18 @@ write_postcfg_conf(){
|
||||||
}
|
}
|
||||||
|
|
||||||
get_yaml(){
|
get_yaml(){
|
||||||
local args=() ext="yaml" yaml
|
local args=() yaml
|
||||||
if ${chrootcfg};then
|
if ${chrootcfg};then
|
||||||
args+=('netinstall')
|
args+=('chrootcfg')
|
||||||
else
|
else
|
||||||
args+=("hybrid")
|
args+=("${profile}/packages")
|
||||||
fi
|
fi
|
||||||
args+=("${initsys}")
|
args+=("${initsys}")
|
||||||
[[ ${edition} == 'sonar' ]] && args+=("${edition}")
|
[[ ${edition} == 'sonar' ]] && args+=("${edition}")
|
||||||
for arg in ${args[@]};do
|
for arg in ${args[@]};do
|
||||||
yaml=${yaml:-}${yaml:+-}${arg}
|
yaml=${yaml:-}${yaml:+-}${arg}
|
||||||
done
|
done
|
||||||
echo "${yaml}.${ext}"
|
echo "${yaml}.yaml"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_netinstall_conf(){
|
write_netinstall_conf(){
|
||||||
|
@ -419,9 +421,9 @@ make_profile_yaml(){
|
||||||
prepare_check "$1"
|
prepare_check "$1"
|
||||||
load_pkgs "${profile_dir}/Packages-Root"
|
load_pkgs "${profile_dir}/Packages-Root"
|
||||||
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
|
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
|
||||||
if [[ -f "${packages_custom}" ]]; then
|
if [[ -f "${packages_desktop}" ]]; then
|
||||||
load_pkgs "${packages_custom}"
|
load_pkgs "${packages_desktop}"
|
||||||
write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")"
|
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
|
||||||
fi
|
fi
|
||||||
${calamares} && write_calamares_yaml "$1"
|
${calamares} && write_calamares_yaml "$1"
|
||||||
user_own "${cache_dir_netinstall}/$1" "-R"
|
user_own "${cache_dir_netinstall}/$1" "-R"
|
||||||
|
|
35
lib/util.sh
35
lib/util.sh
|
@ -307,7 +307,7 @@ init_buildiso(){
|
||||||
|
|
||||||
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
|
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
|
||||||
|
|
||||||
[[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles'
|
[[ -z ${profile_repo} ]] && profile_repo='iso-profiles'
|
||||||
|
|
||||||
mhwd_repo="/opt/pkg"
|
mhwd_repo="/opt/pkg"
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ load_profile_config(){
|
||||||
|
|
||||||
#[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established
|
#[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established
|
||||||
# will be unlocked again after everything has been established.
|
# will be unlocked again after everything has been established.
|
||||||
netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
|
netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
|
||||||
|
|
||||||
[[ -z ${geoip} ]] && geoip='true'
|
[[ -z ${geoip} ]] && geoip='true'
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ 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 packages_custom
|
unset packages_desktop
|
||||||
unset packages_mhwd
|
unset packages_mhwd
|
||||||
unset login_shell
|
unset login_shell
|
||||||
unset tracker_url
|
unset tracker_url
|
||||||
|
@ -533,13 +533,7 @@ check_profile(){
|
||||||
die "Profile [%s] sanity check failed!" "${profile_dir}"
|
die "Profile [%s] sanity check failed!" "${profile_dir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local files=$(ls ${profile_dir}/Packages*)
|
[[ -f "${profile_dir}/Packages-Desktop" ]] && packages_desktop=${profile_dir}/Packages-Desktop
|
||||||
for f in ${files[@]};do
|
|
||||||
case $f in
|
|
||||||
${profile_dir}/Packages-Root|${profile_dir}/Packages-Live|${profile_dir}/Packages-Mhwd) continue ;;
|
|
||||||
*) packages_custom="$f" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd
|
[[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd
|
||||||
|
|
||||||
|
@ -548,15 +542,6 @@ check_profile(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_shared_list(){
|
|
||||||
local path
|
|
||||||
case ${edition} in
|
|
||||||
sonar|netrunner) path=${run_dir}/shared/${edition}/Packages-Desktop ;;
|
|
||||||
*) path=${run_dir}/shared/manjaro/Packages-Desktop ;;
|
|
||||||
esac
|
|
||||||
echo $path
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: file name
|
# $1: file name
|
||||||
load_pkgs(){
|
load_pkgs(){
|
||||||
info "Loading Packages: [%s] ..." "${1##*/}"
|
info "Loading Packages: [%s] ..." "${1##*/}"
|
||||||
|
@ -641,14 +626,7 @@ load_pkgs(){
|
||||||
_purge="s|>cleanup.*||g" \
|
_purge="s|>cleanup.*||g" \
|
||||||
_purge_rm="s|>cleanup||g"
|
_purge_rm="s|>cleanup||g"
|
||||||
|
|
||||||
local list="$1"
|
packages=$(sed "$_com_rm" "$1" \
|
||||||
|
|
||||||
if [[ "$list" == "${packages_custom}" ]];then
|
|
||||||
sort -u $(get_shared_list) ${packages_custom} > ${tmp_dir}/packages-desktop.list
|
|
||||||
list=${tmp_dir}/packages-desktop.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
packages=$(sed "$_com_rm" "$list" \
|
|
||||||
| sed "$_space" \
|
| sed "$_space" \
|
||||||
| sed "$_blacklist" \
|
| sed "$_blacklist" \
|
||||||
| sed "$_purge" \
|
| sed "$_purge" \
|
||||||
|
@ -668,8 +646,7 @@ load_pkgs(){
|
||||||
|
|
||||||
if [[ $1 == "${packages_mhwd}" ]]; then
|
if [[ $1 == "${packages_mhwd}" ]]; then
|
||||||
|
|
||||||
local _used_kernel=${kernel:5:2}
|
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
|
||||||
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
|
|
||||||
|
|
||||||
packages_cleanup=$(sed "$_com_rm" "$1" \
|
packages_cleanup=$(sed "$_com_rm" "$1" \
|
||||||
| grep cleanup \
|
| grep cleanup \
|
||||||
|
|
Loading…
Reference in a new issue