Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
7bf4dff1a1 | |||
529e73e2ab | |||
7be420a24f |
@@ -117,6 +117,7 @@ pretend=false
|
|||||||
images_only=false
|
images_only=false
|
||||||
iso_only=false
|
iso_only=false
|
||||||
persist=false
|
persist=false
|
||||||
|
use_dracut=false
|
||||||
|
|
||||||
basestrap_args=(-GMc)
|
basestrap_args=(-GMc)
|
||||||
cmd=${0##*/}
|
cmd=${0##*/}
|
||||||
@@ -139,6 +140,7 @@ usage() {
|
|||||||
echo ' -x Build images only'
|
echo ' -x Build images only'
|
||||||
echo ' -z Generate iso only'
|
echo ' -z Generate iso only'
|
||||||
echo ' Requires pre built images (-x)'
|
echo ' Requires pre built images (-x)'
|
||||||
|
echo ' -d Use dracut instead of mkinitcpio for iso initramfs'
|
||||||
echo ' -q Query settings and pretend build'
|
echo ' -q Query settings and pretend build'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
@@ -148,7 +150,7 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:r:t:i:g:czxmqh'
|
opts='p:r:t:i:g:czxmdqh'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
@@ -161,6 +163,7 @@ while getopts "${opts}" arg; do
|
|||||||
x) images_only=true ;;
|
x) images_only=true ;;
|
||||||
z) iso_only=true ;;
|
z) iso_only=true ;;
|
||||||
m) persist=true ;;
|
m) persist=true ;;
|
||||||
|
d) use_dracut=true ;;
|
||||||
q) pretend=true ;;
|
q) pretend=true ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||||
|
@@ -12,6 +12,57 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
prepare_boot_extras(){
|
||||||
|
local src="$1" dest=${iso_root}/boot
|
||||||
|
|
||||||
|
for u in intel amd;do
|
||||||
|
cp $src/boot/$u-ucode.img $dest/$u-ucode.img
|
||||||
|
cp $src/usr/share/licenses/$u-ucode/LICENSE $dest/$u-ucode.LICENSE
|
||||||
|
done
|
||||||
|
|
||||||
|
cp $src/boot/memtest86+/memtest.bin $dest/memtest
|
||||||
|
cp $src/usr/share/licenses/common/GPL2/license.txt $dest/memtest.COPYING
|
||||||
|
}
|
||||||
|
|
||||||
|
##################dracut##################
|
||||||
|
|
||||||
|
prepare_initramfs_dracut(){
|
||||||
|
local mnt="$1"
|
||||||
|
local kver=$(<"$mnt"/usr/src/linux/version)
|
||||||
|
|
||||||
|
printf "%s\n" 'add_dracutmodules+=" dmsquash-live"' > "$mnt"/etc/dracut.conf.d/50-live.conf
|
||||||
|
|
||||||
|
msg "Starting build: %s" "${kver}"
|
||||||
|
artools-chroot "$mnt" dracut -fqM /boot/initramfs.img "$kver"
|
||||||
|
msg "Image generation successful"
|
||||||
|
|
||||||
|
cp "$mnt"/boot/initramfs.img "${iso_root}"/boot/initramfs-"${ARCH}".img
|
||||||
|
|
||||||
|
prepare_boot_extras "$mnt"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_grub_dracut(){
|
||||||
|
msg "Configuring grub kernel options ..."
|
||||||
|
local kopts=(
|
||||||
|
"root=live:LABEL=${iso_label}"
|
||||||
|
'rd.live.squashimg=rootfs.img'
|
||||||
|
'rd.live.image'
|
||||||
|
'rootflags=auto'
|
||||||
|
)
|
||||||
|
[[ "${PROFILE}" != 'base' ]] && kopts+=("rd.live.join=livefs.img")
|
||||||
|
|
||||||
|
local ro_opts=()
|
||||||
|
local rw_opts=()
|
||||||
|
# 'rd.writable.fsimg=1'
|
||||||
|
|
||||||
|
sed -e "s|@kopts@|${kopts[*]}|" \
|
||||||
|
-e "s|@ro_opts@|${ro_opts[*]}|" \
|
||||||
|
-e "s|@rw_opts@|${rw_opts[*]}|" \
|
||||||
|
-i ${iso_root}/boot/grub/kernels.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
|
||||||
write_mkinitcpio_conf() {
|
write_mkinitcpio_conf() {
|
||||||
msg2 "Writing mkinitcpio.conf ..."
|
msg2 "Writing mkinitcpio.conf ..."
|
||||||
local conf="$1/etc/mkinitcpio-artix.conf"
|
local conf="$1/etc/mkinitcpio-artix.conf"
|
||||||
@@ -35,18 +86,6 @@ prepare_initcpio(){
|
|||||||
cp /etc/initcpio/artix_shutdown $dest/etc/initcpio
|
cp /etc/initcpio/artix_shutdown $dest/etc/initcpio
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_boot_extras(){
|
|
||||||
local src="$1" dest=${iso_root}/boot
|
|
||||||
|
|
||||||
for u in intel amd;do
|
|
||||||
cp $src/boot/$u-ucode.img $dest/$u-ucode.img
|
|
||||||
cp $src/usr/share/licenses/$u-ucode/LICENSE $dest/$u-ucode.LICENSE
|
|
||||||
done
|
|
||||||
|
|
||||||
cp $src/boot/memtest86+/memtest.bin $dest/memtest
|
|
||||||
cp $src/usr/share/licenses/common/GPL2/license.txt $dest/memtest.COPYING
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_initramfs(){
|
prepare_initramfs(){
|
||||||
local mnt="$1"
|
local mnt="$1"
|
||||||
|
|
||||||
@@ -76,9 +115,10 @@ prepare_initramfs(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure_grub(){
|
configure_grub(){
|
||||||
local ro_opts=("label=${iso_label}")
|
msg "Configuring grub kernel options ..."
|
||||||
local rw_opts=("cow_label=${iso_label}")
|
local ro_opts=()
|
||||||
local kopts=()
|
local rw_opts=()
|
||||||
|
local kopts=("label=${iso_label}")
|
||||||
|
|
||||||
[[ "${PROFILE}" != 'base' ]] && kopts+=('overlay=livefs')
|
[[ "${PROFILE}" != 'base' ]] && kopts+=('overlay=livefs')
|
||||||
|
|
||||||
|
@@ -100,13 +100,13 @@ make_sfs() {
|
|||||||
|
|
||||||
mksquashfs "${mksfs_args[@]}"
|
mksquashfs "${mksfs_args[@]}"
|
||||||
|
|
||||||
make_checksum "${img_name}"
|
if ! ${use_dracut}; then
|
||||||
${persist} && rm -r "${work_dir}/embed"
|
make_checksum "${img_name}"
|
||||||
|
if [[ -n ${GPG_KEY} ]];then
|
||||||
if [[ -n ${GPG_KEY} ]];then
|
make_sig "${img_name}"
|
||||||
make_sig "${img_name}"
|
fi
|
||||||
fi
|
fi
|
||||||
|
${persist} && rm -r "${work_dir}/embed"
|
||||||
fi
|
fi
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||||
}
|
}
|
||||||
|
@@ -157,7 +157,11 @@ make_bootfs() {
|
|||||||
|
|
||||||
mount_overlay "${bootfs}" "${work_dir}"
|
mount_overlay "${bootfs}" "${work_dir}"
|
||||||
|
|
||||||
prepare_initramfs "${bootfs}"
|
if ${use_dracut}; then
|
||||||
|
prepare_initramfs_dracut "${bootfs}"
|
||||||
|
else
|
||||||
|
prepare_initramfs "${bootfs}"
|
||||||
|
fi
|
||||||
|
|
||||||
umount_overlay
|
umount_overlay
|
||||||
|
|
||||||
@@ -176,7 +180,11 @@ make_grub(){
|
|||||||
|
|
||||||
prepare_grub "${work_dir}/rootfs" "$layer"
|
prepare_grub "${work_dir}/rootfs" "$layer"
|
||||||
|
|
||||||
configure_grub
|
if ${use_dracut}; then
|
||||||
|
configure_grub_dracut
|
||||||
|
else
|
||||||
|
configure_grub
|
||||||
|
fi
|
||||||
|
|
||||||
: > ${work_dir}/grub.lock
|
: > ${work_dir}/grub.lock
|
||||||
msg "Done [/iso/boot/grub]"
|
msg "Done [/iso/boot/grub]"
|
||||||
|
Reference in New Issue
Block a user