/lib/partman/init.d/80autouse_swap is in ubiquity 2.18.7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/bin/sh
. /lib/partman/lib/base.sh
mkdir -p /var/lib/partman/autoused_swap
partitions=
for dev in /var/lib/partman/devices/*; do
[ -d "$dev" ] || continue
# Only run the first time each device is encountered
devbase="$(basename "$dev")"
[ ! -f "/var/lib/partman/autoused_swap/$devbase" ] || continue
>"/var/lib/partman/autoused_swap/$devbase"
cd $dev
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
[ -f $id/detected_filesystem ] || continue
fs=$(cat $id/detected_filesystem)
if [ "$fs" = linux-swap ]; then
partitions="$partitions $dev,$id"
fi
done
close_dialog
done
for part in $partitions; do
dev=${part%,*}
id=${part#*,}
[ -d $dev/$id ] || continue
if [ -f $dev/$id/method ]; then
method="$(cat $dev/$id/method)"
if [ "$method" ] && [ "$method" != swap ]; then
# Already used for something else, e.g. RAID
continue
fi
fi
echo swap >$dev/$id/method
> $dev/$id/format
update_partition $dev $id
done
|