Merge branch 'master' of square-r00t.net:bdisk
This commit is contained in:
commit
b6660835d3
15
extra/pre-build.d/etc/mkinitcpio.d/linux.preset
Normal file
15
extra/pre-build.d/etc/mkinitcpio.d/linux.preset
Normal file
@ -0,0 +1,15 @@
|
||||
# mkinitcpio preset file for the 'linux' package
|
||||
|
||||
ALL_config="/etc/mkinitcpio.conf"
|
||||
ALL_kver="/boot/vmlinuz-linux"
|
||||
|
||||
#PRESETS=('default' 'fallback')
|
||||
PRESETS=('default')
|
||||
|
||||
#default_config="/etc/mkinitcpio.conf"
|
||||
default_image="/boot/initramfs-linux.img"
|
||||
#default_options=""
|
||||
|
||||
#fallback_config="/etc/mkinitcpio.conf"
|
||||
#fallback_image="/boot/initramfs-linux-fallback.img"
|
||||
#fallback_options="-S autodetect"
|
@ -11,19 +11,13 @@ _mnt_fs() {
|
||||
ro_dev=$(losetup --find --show --read-only "${img}")
|
||||
echo ${ro_dev} >> /run/archiso/used_block_devices
|
||||
ro_dev_size=$(blockdev --getsz ${ro_dev})
|
||||
if [[ "${cowfile_size}" == "100" ]]; then
|
||||
rw_dev_size=${ro_dev_size}
|
||||
else
|
||||
# size calculation done in this way to avoid integer overflow when ro_dev_size is > 10.2G
|
||||
rw_dev_size=$((ro_dev_size/100*cowfile_size))
|
||||
fi
|
||||
|
||||
if [[ "${cow_persistent}" == "P" ]]; then
|
||||
if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
|
||||
else
|
||||
msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as persistent."
|
||||
dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${rw_dev_size} &> /dev/null
|
||||
truncate -s "${cowfile_size}" "/run/archiso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
else
|
||||
if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
@ -31,13 +25,13 @@ _mnt_fs() {
|
||||
rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
|
||||
dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${rw_dev_size} &> /dev/null
|
||||
truncate -s "${cowfile_size}" "/run/archiso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
|
||||
rw_dev=$(losetup --find --show "/run/archiso/cowspace/${cow_directory}/${img_name}.cow")
|
||||
echo ${rw_dev} >> /run/archiso/used_block_devices
|
||||
|
||||
echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name}
|
||||
dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8"
|
||||
|
||||
_mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w"
|
||||
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices
|
||||
@ -108,9 +102,7 @@ run_hook() {
|
||||
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
|
||||
[[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}"
|
||||
if [[ -z "${cowfile_size}" ]]; then
|
||||
cowfile_size="100"
|
||||
else
|
||||
cowfile_size=${cowfile_size/%}
|
||||
cowfile_size="256M"
|
||||
fi
|
||||
|
||||
if [[ -n "${cow_label}" ]]; then
|
||||
@ -175,8 +167,8 @@ archiso_mount_handler() {
|
||||
mkdir -p "/run/archiso/cowspace/${cow_directory}"
|
||||
|
||||
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs" "/run/archiso/sfs/airootfs"
|
||||
# _mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
|
||||
mount --bind "run/archiso/sfs/airootfs" "/new_root"
|
||||
#_mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
|
||||
mount --bind "/run/archiso/sfs/airootfs" "/new_root"
|
||||
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
umount /run/archiso/bootmnt
|
||||
|
Loading…
Reference in New Issue
Block a user