cow_device-hook

This commit is contained in:
simono41 2018-03-05 07:48:12 +01:00
parent 00d6515d82
commit 4350b4ca4d
3 changed files with 137 additions and 3 deletions

19
hooks/cow_device Executable file
View file

@ -0,0 +1,19 @@
run_hook ()
{
# Format and run immediately cow_device
if [[ "${format}" == "y" ]]; then
sfdisk -l
read -p "Welches Laufwerk soll eine cow_device erhalten? /dev/sda : " formatdevice
[[ -z "${formatdevice}" ]] && formatdevice=/dev/sda
sfdisk -a 2048 -n 3:: -c 3:"cow_device" -t 3:8300 ${formatdevice}
mkfs.btrfs -f -L cow_device ${formatdevice}3
launch_interactive_shell
fi
}
# vim: set ft=sh ts=4 sw=4 et:

112
install/cow_device Executable file
View file

@ -0,0 +1,112 @@
#!/bin/bash
build()
{
add_all_modules /
# syslinux
add_binary extlinux
#add_file /usr/lib/syslinux/bios/gptmbr.bin
#add_file /etc/udev/rules.d/69-save-hdd-live.rules
#add_file "/usr/lib/udev/rules.d/10-dm.rules"
#add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
#add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
#add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
# util-linux
add_binary findmnt
add_binary blockdev
add_binary fdisk
add_binary sfdisk
add_binary hexdump
add_binary losetup
add_binary mkswap
add_binary umount
add_binary wipefs
# e2fsprogs
add_binary badblocks
add_binary chattr
add_binary fsck.ext4
add_binary lsattr
add_binary mkfs.ext4
add_binary tune2fs
# xfsprogs
add_binary mkfs.xfs
add_binary xfs_repair
# cryptsetup
add_binary cryptsetup
# device-mapper
add_binary dmsetup
# gptfdisk
add_binary gdisk
# rsync
add_binary rsync
# coreutils
add_binary cat
add_binary cp
add_binary dd
add_binary mv
add_binary rm
add_binary sync
add_binary md5sum
add_binary sha1sum
add_binary date
# bash
add_binary bash
# findutils
add_binary find
add_binary xargs
# procps-ng
add_binary free
add_binary ps
add_binary slabtop
add_binary top
add_binary vmstat
# smartmontools
add_binary smartctl
#add_file /usr/share/smartmontools/drivedb.h
# hdparm
add_binary hdparm
# ncurses
#add_file /usr/share/terminfo/l/linux
# nano
add_binary nano
# iproute2
add_binary ip
# iw
add_binary iw
# grep
add_binary grep
# blkid
add_binary blkid
# runscript
add_runscript
}
help ()
{
cat <<HELPEOF
Rescue hook!
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -108,6 +108,9 @@ function filesystem() {
cp -v script/archiso* ${work_dir}/${arch}/airootfs/usr/lib/initcpio/
cp -v install/cow_device ${work_dir}/${arch}/airootfs/usr/lib/initcpio/install/
cp -v hooks/cow_device ${work_dir}/${arch}/airootfs/usr/lib/initcpio/hooks/
fi
@ -120,6 +123,9 @@ function IMAGE() {
if [ "$image" != "n" ]
then
echo "System wird gereinigt und komprimiert!!!"
sleep 5
mkdir -p ${work_dir}/iso/${install_dir}/${arch}/airootfs/
arch-chroot ${work_dir}/${arch}/airootfs /bin/bash <<EOT
@ -139,9 +145,6 @@ EOT
echo "airootfs.sfs nicht vorhanden!"
fi
echo "System wird Komprimiert!!!"
sleep 5
mksquashfs ${work_dir}/${arch}/airootfs ${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs -comp xz -b 262144
sha512sum ${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs > airootfs.sha512