diff options
author | Gerardo Exequiel Pozzi <vmlinuz386@gmail.com> | 2014-10-12 21:03:52 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@gmail.com> | 2014-10-13 21:15:22 -0300 |
commit | edfdd37ba00bcb51e293f1aae2aac3a679076406 (patch) | |
tree | b884e119b05fa627388470857ebb80c34a144069 /archiso/initcpio | |
parent | ccbeb35a7f4521cb2ba8b1357d1e9d14bbc8078b (diff) | |
download | archiso32-edfdd37ba00bcb51e293f1aae2aac3a679076406.tar.xz |
[archiso] Change cowfile_size= behavior
Move from percent to explicit size and set a default of 256M (sparse)
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
Diffstat (limited to 'archiso/initcpio')
-rw-r--r-- | archiso/initcpio/hooks/archiso | 16 | ||||
-rw-r--r-- | archiso/initcpio/install/archiso | 1 |
2 files changed, 5 insertions, 12 deletions
diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 4c50566..8b90185 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -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 diff --git a/archiso/initcpio/install/archiso b/archiso/initcpio/install/archiso index 8893667..e506271 100644 --- a/archiso/initcpio/install/archiso +++ b/archiso/initcpio/install/archiso @@ -12,6 +12,7 @@ build() { add_binary dmsetup add_binary losetup add_binary mountpoint + add_binary truncate add_file /usr/lib/udev/rules.d/60-cdrom_id.rules add_file /usr/lib/udev/rules.d/10-dm.rules |