HOWTO Freeze Linux

wipe
#!/bin/bash
if mount /dev/sda6 /mnt; then
	btrfs subvolume delete /mnt/home-rw
	if btrfs subvolume snapshot /mnt/home-ro /mnt/home-rw; then
		if umount /home; then
			if mount -o subvol=home-rw /dev/sda6 /home; then
				ret=0
			else
				ret=4
			fi
		else
			ret=3
		fi
	else
		ret=2
	fi
else
	ret=1
fi
umount /mnt
if [ $? -ne 0 ]; then
	ret=1"$ret"
fi
 
exit $ret
wipe.service
[Unit]
Description=Wipe home directory modifications
Requires=local-fs.target
After=local-fs.target
Before=systemd-user-sessions.service
 
[Install]
WantedBy=systemd-user-sessions.service
 
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/wipe