forked from mirrored-repos/manjaro-tools
prepare 0.15.1 (#261)
* improve btrfs handling devtools patches * buildios: drop ck on openrc * data: update base-devel-udev * util-iso-image: configure live logind on openrc too * util-iso-image: fix logind cof path on openrc * util-mount: always bind mount /etc/resolve.conf in chroot * util: create empty /etc/resolv.conf on minimal requirement for pacman * util: revert last 2 commits, default mirrorliust is now always generated * util-iso-image: simplify logind config * data: rm workaround from mlinitcpio.conf * data: reenable workaround * Unify grub (#262) * initial commit testing unified grub * buildiso: update to working grub version * data: remove grub; move to own repo * buildiso: adopt new grub-theme path * clean up makefile * buildiso: rm pxe_boot switch; always enabled now * data: rm memdisk hook from initcpio * util-iso-boot: clean up grub code * initcpio_ back pxe hook arch patch * buildiso: * always clean entire chroot profile on -c * tweak kernels.cfg * util-iso-boot: fix efiboot mount path * util-iso-boot: some corrections to efi.img * buildiso: improve grub configuration * util-iso-boot: add mhwd args in configure_grub() * util-iso-boot: fix typo in mhwd args * util-iso-boot: display proper grub image name for efi image
This commit is contained in:
parent
c7f309fda3
commit
42e0735b77
16 changed files with 170 additions and 261 deletions
33
Makefile
33
Makefile
|
@ -26,12 +26,10 @@ SHARED_BASE = \
|
|||
data/pacman-mirrors.conf
|
||||
|
||||
LIST_PKG = \
|
||||
data/pkg.list.d/default.list
|
||||
$(wildcard data/pkg.list.d/*.list)
|
||||
|
||||
ARCH_CONF = \
|
||||
data/make.conf.d/i686.conf \
|
||||
data/make.conf.d/x86_64.conf \
|
||||
data/make.conf.d/multilib.conf
|
||||
$(wildcard data/make.conf.d/*.conf)
|
||||
|
||||
BIN_PKG = \
|
||||
bin/checkpkg \
|
||||
|
@ -52,10 +50,7 @@ SHARED_PKG = \
|
|||
data/base-devel-udev
|
||||
|
||||
LIST_ISO = \
|
||||
data/iso.list.d/default.list \
|
||||
data/iso.list.d/manjaro.list \
|
||||
data/iso.list.d/community.list \
|
||||
data/iso.list.d/sonar.list
|
||||
$(wildcard data/iso.list.d/*.list)
|
||||
|
||||
BIN_ISO = \
|
||||
bin/buildiso \
|
||||
|
@ -63,10 +58,7 @@ BIN_ISO = \
|
|||
bin/deployiso
|
||||
|
||||
LIBS_ISO = \
|
||||
lib/util-iso.sh \
|
||||
lib/util-iso-mount.sh \
|
||||
lib/util-iso-image.sh \
|
||||
lib/util-iso-boot.sh \
|
||||
$(wildcard lib/util-iso*.sh) \
|
||||
lib/util-publish.sh
|
||||
|
||||
SHARED_ISO = \
|
||||
|
@ -75,23 +67,10 @@ SHARED_ISO = \
|
|||
data/profile.conf.example
|
||||
|
||||
CPIOHOOKS = \
|
||||
initcpio/hooks/miso \
|
||||
initcpio/hooks/miso_loop_mnt \
|
||||
initcpio/hooks/miso_pxe_common \
|
||||
initcpio/hooks/miso_pxe_http \
|
||||
initcpio/hooks/miso_pxe_nbd \
|
||||
initcpio/hooks/miso_pxe_nfs \
|
||||
initcpio/hooks/miso_shutdown
|
||||
$(wildcard initcpio/hooks/*)
|
||||
|
||||
CPIOINST = \
|
||||
initcpio/install/miso \
|
||||
initcpio/install/miso_loop_mnt \
|
||||
initcpio/install/miso_pxe_common \
|
||||
initcpio/install/miso_pxe_http \
|
||||
initcpio/install/miso_pxe_nbd \
|
||||
initcpio/install/miso_pxe_nfs \
|
||||
initcpio/install/miso_kms \
|
||||
initcpio/install/miso_shutdown
|
||||
$(wildcard initcpio/install/*)
|
||||
|
||||
CPIO = \
|
||||
initcpio/script/miso_shutdown
|
||||
|
|
|
@ -25,7 +25,6 @@ show_profile(){
|
|||
if ${verbose};then
|
||||
msg2 "autologin: %s" "${autologin}"
|
||||
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
|
||||
msg2 "pxe_boot: %s" "${pxe_boot}"
|
||||
|
||||
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ show_profile(){
|
|||
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
|
||||
msg2 "autologin: %s" "${autologin}"
|
||||
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
|
||||
msg2 "pxe_boot: %s" "${pxe_boot}"
|
||||
|
||||
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
|
||||
|
||||
|
|
|
@ -81,12 +81,12 @@ umask 0022
|
|||
|
||||
lock 9 "${working_dir}.lock" "Locking chroot"
|
||||
|
||||
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
|
||||
rmdir "$working_dir"
|
||||
if ! btrfs subvolume create "$working_dir"; then
|
||||
die "Couldn't create subvolume for '%s'" "$working_dir"
|
||||
fi
|
||||
chmod 0755 "$working_dir"
|
||||
if is_btrfs "$working_dir"; then
|
||||
rmdir "$working_dir"
|
||||
if ! btrfs subvolume create "$working_dir"; then
|
||||
die "Couldn't create subvolume for '%s'" "$working_dir"
|
||||
fi
|
||||
chmod 0755 "$working_dir"
|
||||
fi
|
||||
|
||||
# Workaround when creating a chroot in a branch different of the host
|
||||
|
|
|
@ -128,11 +128,9 @@ create_chroot() {
|
|||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
||||
|
||||
stat_busy "Creating clean working copy [$copy]"
|
||||
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||
if [[ -d $copydir ]]; then
|
||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
fi
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||
die "Unable to create subvolume %s" "$copydir"
|
||||
else
|
||||
|
@ -151,7 +149,7 @@ create_chroot() {
|
|||
|
||||
clean_temporary() {
|
||||
stat_busy "Removing temporary copy [$copy]"
|
||||
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
else
|
||||
|
|
|
@ -2,7 +2,7 @@ autoconf
|
|||
automake
|
||||
binutils
|
||||
bison
|
||||
libeudev-systemd
|
||||
libeudev
|
||||
fakeroot
|
||||
file
|
||||
findutils
|
||||
|
@ -22,7 +22,7 @@ pkg-config
|
|||
sed
|
||||
sudo
|
||||
texinfo
|
||||
util-linux
|
||||
util-linux-nosystemd
|
||||
which
|
||||
>multilib gcc-multilib
|
||||
>multilib lib32-fakeroot
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
MODULES="loop dm-snapshot"
|
||||
HOOKS="base udev memdisk miso_shutdown miso miso_loop_mnt miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs miso_kms modconf block pcmcia filesystems keyboard keymap"
|
||||
HOOKS="base udev miso_shutdown miso miso_loop_mnt miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs miso_kms modconf block pcmcia filesystems keyboard keymap"
|
||||
COMPRESSION="xz"
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
# use multilib packages; x86_64 only
|
||||
# multilib="true"
|
||||
|
||||
# use pxe
|
||||
# pxe_boot="true"
|
||||
|
||||
# use extra packages as defined in pkglist to activate a full profile
|
||||
# extra="false"
|
||||
|
||||
|
|
|
@ -117,15 +117,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>pxe_boot=</varname></term>
|
||||
|
||||
<listitem><para>Accepts
|
||||
<option>true</option> (the default)
|
||||
<option>false</option>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>multilib=</varname></term>
|
||||
|
||||
|
|
|
@ -22,11 +22,15 @@ run_hook () {
|
|||
break
|
||||
fi
|
||||
done
|
||||
ip="${ip}::${bootif_dev}"
|
||||
if [[ "${ip}" == "dhcp" ]]; then
|
||||
ip=":::::${bootif_dev}:dhcp"
|
||||
else
|
||||
ip="${ip}::${bootif_dev}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# setup network and save some values
|
||||
if ! ipconfig "ip=${ip}"; then
|
||||
if ! ipconfig -t 20 "ip=${ip}"; then
|
||||
echo "ERROR; Failed to configure network"
|
||||
echo " Falling back to interactive prompt"
|
||||
echo " You can try to fix the problem manually, log out when you are finished"
|
||||
|
|
|
@ -9,14 +9,6 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
set_mkinicpio_hooks(){
|
||||
if ! ${pxe_boot};then
|
||||
msg2 "Removing pxe hooks"
|
||||
sed -e 's/miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs //' \
|
||||
-e 's/memdisk //' -i $1
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_initcpio(){
|
||||
msg2 "Copying initcpio ..."
|
||||
cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks
|
||||
|
@ -26,7 +18,6 @@ prepare_initcpio(){
|
|||
|
||||
prepare_initramfs(){
|
||||
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
|
||||
set_mkinicpio_hooks "$1/etc/mkinitcpio-${iso_name}.conf"
|
||||
local _kernver=$(cat $1/usr/lib/modules/*/version)
|
||||
if [[ -n ${gpgkey} ]]; then
|
||||
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
|
||||
|
@ -52,91 +43,73 @@ prepare_boot_extras(){
|
|||
cp $1/usr/share/licenses/common/GPL2/license.txt $2/memtest.COPYING
|
||||
}
|
||||
|
||||
prepare_efiboot_image(){
|
||||
local efi=$1/EFI/miso boot=$2/${iso_name}/boot
|
||||
prepare_dir "${efi}"
|
||||
cp ${boot}/x86_64/vmlinuz ${efi}/vmlinuz.efi
|
||||
cp ${boot}/x86_64/initramfs.img ${efi}/initramfs.img
|
||||
if [[ -f ${boot}/intel_ucode.img ]] ; then
|
||||
cp ${boot}/intel_ucode.img ${efi}/intel_ucode.img
|
||||
fi
|
||||
}
|
||||
|
||||
vars_to_boot_conf(){
|
||||
sed -e "s|@ISO_NAME@|${iso_name}|g" \
|
||||
-e "s|@ISO_LABEL@|${iso_label}|g" \
|
||||
-e "s|@DIST_NAME@|${dist_name}|g" \
|
||||
configure_grub(){
|
||||
local default_args="misobasedir=${iso_name} misolabel=${iso_label}" \
|
||||
video_args="nouveau.modeset=1 i915.modeset=1 radeon.modeset=1" \
|
||||
boot_args=(quiet)
|
||||
[[ $2 == 'systemd' ]] && boot_args+=(systemd.show_status=1)
|
||||
|
||||
local mhwd_args="nonfree=$4"
|
||||
|
||||
sed -e "s|@DIST_NAME@|${dist_name}|g" \
|
||||
-e "s|@ARCH@|${target_arch}|g" \
|
||||
-e "s|@DRV@|$2|g" \
|
||||
-e "s|@SWITCH@|$3|g" \
|
||||
-e "s|@BOOT_ARGS@||g" \
|
||||
-e "s|@DEFAULT_ARGS@|${default_args}|g" \
|
||||
-e "s|@VIDEO_ARGS@|${video_args}|g" \
|
||||
-e "s|@BOOT_ARGS@|${boot_args[@]}|g" \
|
||||
-e "s|@MHWD_ARGS@|${mhwd_args}|g" \
|
||||
-e "s|@PROFILE@|$3|g" \
|
||||
-i $1
|
||||
}
|
||||
|
||||
prepare_efi_loader(){
|
||||
local efi_data=$1/usr/share/efi-utils efi=$2/EFI/boot
|
||||
msg2 "Preparing efi loaders ..."
|
||||
prepare_dir "${efi}"
|
||||
cp $1/usr/share/efitools/efi/PreLoader.efi ${efi}/bootx64.efi
|
||||
cp $1/usr/share/efitools/efi/HashTool.efi ${efi}
|
||||
cp ${efi_data}/gummibootx64.efi ${efi}/loader.efi
|
||||
cp ${efi_data}/shellx64_v{1,2}.efi $2/EFI
|
||||
prepare_grub(){
|
||||
local platform=i386-pc img='core.img' grub=$2/boot/grub efi=$2/efi/boot \
|
||||
data=$1/usr/share/grub lib=$1/usr/lib/grub prefix=/boot/grub
|
||||
|
||||
local entries=$2/loader/entries
|
||||
msg2 "Preparing efi loader config ..."
|
||||
prepare_dir "${entries}"
|
||||
prepare_dir ${grub}/${platform}
|
||||
|
||||
cp ${efi_data}/loader.conf $2/loader/loader.conf
|
||||
vars_to_boot_conf $2/loader/loader.conf
|
||||
cp ${efi_data}/uefi-shell-v{1,2}-x86_64.conf ${entries}
|
||||
cp ${data}/cfg/*.cfg ${grub}
|
||||
|
||||
local label='free' switch="no"
|
||||
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64.conf
|
||||
vars_to_boot_conf "${entries}/${iso_name}-x86_64.conf" "$label" "$switch"
|
||||
if ${nonfree_mhwd};then
|
||||
label='nonfree' switch="yes"
|
||||
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64-nonfree.conf
|
||||
vars_to_boot_conf "${entries}/${iso_name}-x86_64-nonfree.conf" "$label" "$switch"
|
||||
fi
|
||||
}
|
||||
|
||||
check_syslinux_select(){
|
||||
local boot=${iso_root}/${iso_name}/boot
|
||||
if [[ ! -f ${boot}/x86_64/vmlinuz ]] ; then
|
||||
msg2 "Configuring syslinux for i686 architecture only ..."
|
||||
sed -e "s/select.cfg/i686_inc.cfg/g" -i "$1/miso.cfg"
|
||||
fi
|
||||
}
|
||||
|
||||
check_syslinux_nonfree(){
|
||||
msg2 "Configuring syslinux menu ..."
|
||||
sed -e "/LABEL nonfree/,/^$/d" -i "$1/miso_sys_i686.cfg"
|
||||
sed -e "/LABEL nonfree/,/^$/d" -i "$1/miso_sys_x86_64.cfg"
|
||||
sed -e "/nonfree/ d" -i $1/syslinux.msg
|
||||
}
|
||||
|
||||
prepare_isolinux(){
|
||||
local syslinux=$1/usr/lib/syslinux/bios
|
||||
msg2 "Copying isolinux binaries ..."
|
||||
cp ${syslinux}/{{isolinux,isohdpfx}.bin,ldlinux.c32} $2
|
||||
msg2 "Copying isolinux.cfg ..."
|
||||
cp $1/usr/share/syslinux/isolinux/isolinux.cfg $2
|
||||
vars_to_boot_conf "$2/isolinux.cfg"
|
||||
}
|
||||
|
||||
prepare_syslinux(){
|
||||
local syslinux=$1/usr/lib/syslinux/bios
|
||||
msg2 "Copying syslinux binaries ..."
|
||||
cp ${syslinux}/{*.c32,lpxelinux.0,memdisk} $2
|
||||
msg2 "Copying syslinux theme ..."
|
||||
syslinux=$1/usr/share/syslinux/theme
|
||||
cp ${syslinux}/* $2
|
||||
for conf in $2/*.cfg; do
|
||||
vars_to_boot_conf "${conf}"
|
||||
done
|
||||
# Check for dual-arch
|
||||
check_syslinux_select "$2"
|
||||
if ! ${nonfree_mhwd};then
|
||||
check_syslinux_nonfree "$2"
|
||||
fi
|
||||
cp ${lib}/${platform}/* ${grub}/${platform}
|
||||
|
||||
msg2 "Building %s ..." "${img}"
|
||||
|
||||
grub-mkimage -d ${grub}/${platform} -o ${grub}/${platform}/${img} -O ${platform} -p ${prefix} biosdisk iso9660
|
||||
|
||||
cat ${grub}/${platform}/cdboot.img ${grub}/${platform}/${img} > ${grub}/${platform}/eltorito.img
|
||||
|
||||
case ${target_arch} in
|
||||
'i686')
|
||||
platform=i386-efi
|
||||
img=bootia32.efi
|
||||
;;
|
||||
'x86_64')
|
||||
platform=x86_64-efi
|
||||
img=bootx64.efi
|
||||
;;
|
||||
esac
|
||||
|
||||
prepare_dir ${efi}
|
||||
prepare_dir ${grub}/${platform}
|
||||
|
||||
cp ${lib}/${platform}/* ${grub}/${platform}
|
||||
|
||||
msg2 "Building %s ..." "${img}"
|
||||
|
||||
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660
|
||||
|
||||
prepare_dir ${grub}/themes
|
||||
cp -r ${data}/themes/${iso_name}-live ${grub}/themes/
|
||||
cp ${data}/unicode.pf2 ${grub}
|
||||
cp -r ${data}/{locales,tz} ${grub}
|
||||
|
||||
local size=8M mnt="${mnt_dir}/efiboot" efi_img="$2/efi.img"
|
||||
msg2 "Creating fat image of %s ..." "${size}"
|
||||
truncate -s ${size} "${efi_img}"
|
||||
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
|
||||
prepare_dir "${mnt}"
|
||||
mount_img "${efi_img}" "${mnt}"
|
||||
prepare_dir ${mnt}/efi/boot
|
||||
msg2 "Building %s ..." "${img}"
|
||||
grub-mkimage -d ${grub}/${platform} -o ${mnt}/efi/boot/${img} -O ${platform} -p ${prefix} iso9660
|
||||
umount_img "${mnt}"
|
||||
}
|
||||
|
|
|
@ -84,18 +84,9 @@ configure_lsb(){
|
|||
fi
|
||||
}
|
||||
|
||||
configure_mhwd(){
|
||||
if [[ ${target_arch} == "x86_64" ]];then
|
||||
if ! ${multilib};then
|
||||
msg2 "Disable mhwd lib32 support"
|
||||
echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
configure_logind(){
|
||||
msg2 "Configuring logind ..."
|
||||
local conf=$1/etc/systemd/logind.conf
|
||||
local conf=$1/etc/$2/logind.conf
|
||||
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
|
||||
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
|
||||
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
|
||||
|
@ -166,8 +157,8 @@ configure_hosts(){
|
|||
configure_system(){
|
||||
case ${initsys} in
|
||||
'systemd')
|
||||
configure_logind "$1" "systemd"
|
||||
configure_journald "$1"
|
||||
configure_logind "$1"
|
||||
|
||||
# Prevent some services to be started in the livecd
|
||||
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
|
||||
|
@ -175,14 +166,14 @@ configure_system(){
|
|||
|
||||
msg2 "Disable systemd-gpt-auto-generator"
|
||||
ln -sf /dev/null "${path}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
|
||||
|
||||
echo ${hostname} > $1/etc/hostname
|
||||
;;
|
||||
'openrc')
|
||||
local hn='hostname="'${hostname}'"'
|
||||
sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
|
||||
configure_logind "$1" "elogind"
|
||||
# local hn='hostname="'${hostname}'"'
|
||||
# sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
|
||||
;;
|
||||
esac
|
||||
echo ${hostname} > $1/etc/hostname
|
||||
}
|
||||
|
||||
configure_thus(){
|
||||
|
@ -211,7 +202,6 @@ configure_thus(){
|
|||
configure_live_image(){
|
||||
msg "Configuring [livefs]"
|
||||
configure_hosts "$1"
|
||||
configure_mhwd "$1"
|
||||
configure_system "$1"
|
||||
configure_services "$1"
|
||||
configure_calamares "$1"
|
||||
|
@ -251,13 +241,18 @@ chroot_create(){
|
|||
mkchroot ${mkchroot_args[*]} ${flag} $@
|
||||
}
|
||||
|
||||
clean_iso_root(){
|
||||
msg2 "Deleting isoroot [%s] ..." "${1##*/}"
|
||||
rm -rf --one-file-system "$1"
|
||||
}
|
||||
|
||||
chroot_clean(){
|
||||
msg "Cleaning up ..."
|
||||
for image in "$1"/*fs; do
|
||||
[[ -d ${image} ]] || continue
|
||||
local name=${image##*/}
|
||||
if [[ $name != "mhwdfs" ]];then
|
||||
msg2 "Deleting chroot [%s] ..." "$name"
|
||||
msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}"
|
||||
lock 9 "${image}.lock" "Locking chroot '${image}'"
|
||||
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
|
||||
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
|
||||
|
@ -267,8 +262,6 @@ chroot_clean(){
|
|||
done
|
||||
exec 9>&-
|
||||
rm -rf --one-file-system "$1"
|
||||
msg2 "Deleting isoroot [%s] ..." "${2##*/}"
|
||||
rm -rf --one-file-system "$2"
|
||||
}
|
||||
|
||||
clean_up_image(){
|
||||
|
|
134
lib/util-iso.sh
134
lib/util-iso.sh
|
@ -161,33 +161,30 @@ make_sfs() {
|
|||
|
||||
assemble_iso(){
|
||||
msg "Creating ISO image..."
|
||||
local efi_boot_args=() iso_publisher iso_app_id
|
||||
if [[ -f "${iso_root}/EFI/miso/efiboot.img" ]]; then
|
||||
msg2 "Setting efi args. El Torito detected."
|
||||
efi_boot_args=("-eltorito-alt-boot"
|
||||
"-e EFI/miso/efiboot.img"
|
||||
"-isohybrid-gpt-basdat"
|
||||
"-no-emul-boot")
|
||||
fi
|
||||
local iso_publisher iso_app_id
|
||||
|
||||
iso_publisher="$(get_osname) <$(get_disturl)>"
|
||||
|
||||
iso_app_id="$(get_osname) Live/Rescue CD"
|
||||
|
||||
|
||||
xorriso -as mkisofs \
|
||||
-iso-level 3 -rock -joliet \
|
||||
-max-iso9660-filenames -omit-period \
|
||||
-omit-version-number \
|
||||
-relaxed-filenames -allow-lowercase \
|
||||
--protective-msdos-label \
|
||||
-volid "${iso_label}" \
|
||||
-appid "${iso_app_id}" \
|
||||
-publisher "${iso_publisher}" \
|
||||
-preparer "Prepared by manjaro-tools/${0##*/}" \
|
||||
-eltorito-boot isolinux/isolinux.bin \
|
||||
-eltorito-catalog isolinux/boot.cat \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
-isohybrid-mbr "${iso_root}/isolinux/isohdpfx.bin" \
|
||||
${efi_boot_args[@]} \
|
||||
-e /efi.img \
|
||||
-b boot/grub/i386-pc/eltorito.img \
|
||||
-c boot.catalog \
|
||||
-no-emul-boot \
|
||||
-boot-load-size 4 \
|
||||
-boot-info-table \
|
||||
-graft-points \
|
||||
--grub2-boot-info \
|
||||
--grub2-mbr ${iso_root}/boot/grub/i386-pc/boot_hybrid.img \
|
||||
--sort-weight 0 / --sort-weight 1 /boot \
|
||||
-isohybrid-gpt-basdat \
|
||||
-eltorito-alt-boot \
|
||||
-output "${iso_dir}/${iso_file}" \
|
||||
"${iso_root}/"
|
||||
}
|
||||
|
@ -345,11 +342,12 @@ make_image_mhwd() {
|
|||
|
||||
make_image_boot() {
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [/iso/%s/boot]" "${iso_name}"
|
||||
local boot="${iso_root}/${iso_name}/boot"
|
||||
mkdir -p ${boot}/${target_arch}
|
||||
msg "Prepare [/iso/boot]"
|
||||
local boot="${iso_root}/boot"
|
||||
|
||||
mkdir -p ${boot}
|
||||
|
||||
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/${target_arch}/vmlinuz
|
||||
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
|
||||
|
||||
local path="${work_dir}/bootfs"
|
||||
mkdir -p ${path}
|
||||
|
@ -363,74 +361,29 @@ make_image_boot() {
|
|||
prepare_initcpio "${path}"
|
||||
prepare_initramfs "${path}"
|
||||
|
||||
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
|
||||
cp ${path}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
|
||||
prepare_boot_extras "${path}" "${boot}"
|
||||
|
||||
umount_fs
|
||||
|
||||
rm -R ${path}
|
||||
: > ${work_dir}/build.${FUNCNAME}
|
||||
msg "Done [/iso/%s/boot]" "${iso_name}"
|
||||
msg "Done [/iso/boot]"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prepare /EFI
|
||||
make_efi_usb() {
|
||||
make_grub(){
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [/iso/EFI]"
|
||||
prepare_efi_loader "${work_dir}/livefs" "${iso_root}" "usb"
|
||||
msg "Prepare [/iso/boot/grub]"
|
||||
|
||||
local path="${work_dir}/rootfs"
|
||||
|
||||
prepare_grub "${path}" "${iso_root}"
|
||||
|
||||
configure_grub "${iso_root}/boot/grub/kernels.cfg" "${initsys}" "${profile}" "${nonfree_mhwd}"
|
||||
|
||||
: > ${work_dir}/build.${FUNCNAME}
|
||||
msg "Done [/iso/EFI]"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
|
||||
make_efi_dvd() {
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [/efiboot/EFI]"
|
||||
local src="${iso_root}/EFI/miso"
|
||||
mkdir -p "${src}"
|
||||
|
||||
local size=31M
|
||||
local mnt="${mnt_dir}/efiboot" img="${src}/efiboot.img"
|
||||
${pxe_boot} && size=46M
|
||||
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}
|
||||
msg "Done [/efiboot/EFI]"
|
||||
fi
|
||||
}
|
||||
|
||||
make_isolinux() {
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [/iso/isolinux]"
|
||||
local isolinux=${iso_root}/isolinux
|
||||
mkdir -p ${isolinux}
|
||||
prepare_isolinux "${work_dir}/livefs" "${isolinux}"
|
||||
|
||||
: > ${work_dir}/build.${FUNCNAME}
|
||||
msg "Done [/iso/isolinux]"
|
||||
fi
|
||||
}
|
||||
|
||||
make_syslinux() {
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [/iso/${iso_name}/boot/syslinux]"
|
||||
local syslinux=${iso_root}/${iso_name}/boot/syslinux
|
||||
mkdir -p ${syslinux}
|
||||
prepare_syslinux "${work_dir}/livefs" "${syslinux}"
|
||||
mkdir -p ${syslinux}/hdt
|
||||
# gzip -c -9 ${work_dir}/rootfs/usr/share/hwdata/pci.ids > ${syslinux}/hdt/pciids.gz
|
||||
# gzip -c -9 ${work_dir}/livefs/usr/lib/modules/*-MANJARO/modules.alias > ${syslinux}/hdt/modalias.gz
|
||||
: > ${work_dir}/build.${FUNCNAME}
|
||||
msg "Done [/iso/${iso_name}/boot/syslinux]"
|
||||
msg "Done [/iso/boot/grub]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -478,12 +431,8 @@ prepare_images(){
|
|||
run_safe "make_image_mhwd"
|
||||
fi
|
||||
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
|
||||
run_safe "make_grub"
|
||||
|
||||
show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||
}
|
||||
|
||||
|
@ -498,7 +447,20 @@ archive_logs(){
|
|||
|
||||
make_profile(){
|
||||
msg "Start building [%s]" "${profile}"
|
||||
${clean_first} && chroot_clean "${work_dir}" "${iso_root}"
|
||||
if ${clean_first};then
|
||||
chroot_clean "${chroots_iso}/${profile}/${target_arch}"
|
||||
|
||||
local unused_arch=''
|
||||
case ${target_arch} in
|
||||
i686) unused_arch='x86_64' ;;
|
||||
x86_64) unused_arch='i686' ;;
|
||||
esac
|
||||
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then
|
||||
chroot_clean "${chroots_iso}/${profile}/${unused_arch}"
|
||||
fi
|
||||
clean_iso_root "${iso_root}"
|
||||
fi
|
||||
|
||||
if ${iso_only}; then
|
||||
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${profile}"
|
||||
compress_images
|
||||
|
|
|
@ -209,9 +209,7 @@ chroot_clean(){
|
|||
|
||||
lock 9 "${copy}.lock" "Locking chroot copy '${copy}'"
|
||||
|
||||
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
|
||||
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
|
||||
fi
|
||||
subvolume_delete_recursive "${copy}"
|
||||
rm -rf --one-file-system "${copy}"
|
||||
done
|
||||
exec 9>&-
|
||||
|
|
|
@ -21,11 +21,11 @@ write_machineid_conf(){
|
|||
|
||||
write_finished_conf(){
|
||||
msg2 "Writing %s ..." "finished.conf"
|
||||
local conf="${modules_dir}/finished.conf" cmd="shutdown -r now"
|
||||
local conf="${modules_dir}/finished.conf" cmd="loginctl reboot"
|
||||
echo '---' > "$conf"
|
||||
echo 'restartNowEnabled: true' >> "$conf"
|
||||
echo 'restartNowChecked: false' >> "$conf"
|
||||
[[ ${initsys} == 'systemd' ]] && cmd="systemctl -i reboot"
|
||||
[[ ${initsys} == 'systemd' ]] && cmd="systemctl reboot"
|
||||
echo "restartNowCommand: \"${cmd}\"" >> "$conf"
|
||||
}
|
||||
|
||||
|
|
24
lib/util.sh
24
lib/util.sh
|
@ -375,8 +375,6 @@ load_profile_config(){
|
|||
|
||||
[[ -z ${multilib} ]] && multilib="true"
|
||||
|
||||
[[ -z ${pxe_boot} ]] && pxe_boot="true"
|
||||
|
||||
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
|
||||
|
||||
[[ -z ${efi_boot_loader} ]] && efi_boot_loader="grub"
|
||||
|
@ -400,7 +398,7 @@ load_profile_config(){
|
|||
[[ -z ${disable_systemd[@]} ]] && disable_systemd=('pacman-init')
|
||||
|
||||
if [[ -z ${enable_openrc[@]} ]];then
|
||||
enable_openrc=('acpid' 'bluetooth' 'cgmanager' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
enable_openrc=('acpid' 'bluetooth' 'elogind' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
fi
|
||||
|
||||
[[ -z ${disable_openrc[@]} ]] && disable_openrc=()
|
||||
|
@ -447,7 +445,6 @@ reset_profile(){
|
|||
unset displaymanager
|
||||
unset autologin
|
||||
unset multilib
|
||||
unset pxe_boot
|
||||
unset nonfree_mhwd
|
||||
unset efi_boot_loader
|
||||
unset hostname
|
||||
|
@ -760,3 +757,22 @@ run(){
|
|||
$1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
is_btrfs() {
|
||||
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
|
||||
}
|
||||
|
||||
subvolume_delete_recursive() {
|
||||
local subvol
|
||||
|
||||
is_btrfs "$1" || return 0
|
||||
|
||||
while IFS= read -d $'\0' -r subvol; do
|
||||
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
|
||||
error "Unable to delete subvolume %s" "$subvol"
|
||||
return 1
|
||||
fi
|
||||
done < <(find "$1" -xdev -depth -inum 256 -print0)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue