DeepFreeze for Linux (Advance)
I have writen bout DeepFreeze for Linux before. But here, this script more compleks with Graphical Interface. Then, Let's Freeze your Linux.
Make a bash script named deepfreeze with this content first.
If your distro doesn't use rc.d but init.d, You should change position of rc.local from /etc/rc.d/ to the right directory.
The last step is change the mode
Just double cliks it to activate. Or type in your console
Make a bash script named deepfreeze with this content first.
#!/bin/bash
# Deepfreeze a la Linux
# Backup before use, Use At Your Own Risk
# Copyleft 2007 by A. Hardiena
# Translated by fortmunir
Xdialog --title "Deepfreeze ala Linux" \
--menubox " Welcome to Deepfreeze ala Linux." 17 65 3 \
"Install" "Install Deepfreeze" \
"Remove" "Remove Deepfreeze"
"Abort" "Abort Installer" 2>/tmp/checklist.tmp.$$
choice=`cat /tmp/checklist.tmp.$$
rm -f /tmp/checklist.tmp.$$
case $choice in
"Install"
ask=`mktemp -q /tmp/menu.XXXXXX`
header="Deepfreeze ala Linux"
size="9 60"
content="Home folder you want to protect."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask
if [ ! $?= 0 ]; then exit 0
fi
directory=`cat $ask`
check=`cat /etc//rc.d/rc.local | grep `# Deepfreeze System'`
temporary=" Deepfreeze System"
if [ "$check" == "$temporary" ]; then
sed -i "/# Deepfreeze/d" /etc/rc.d/rc.local
rm /home/$directory.tar.gz
fi
# Processing Deepfreeze and put to /etc/rc.d/rc.local
cd /home/
rm $directory.tar.gz
tar -cf $directory.tar $directory
gzip --best $directory.tar
cat << EOF >> /etc/rc.d/rc.local
# Deepfreeze System
cd /home/ # Deepfreeze do not manual editing this line
rm -f /home/$directory # Deepfreeze do not manual editing this line
# Deepfreeze has ended here
EOF
# Check if autorecovery has errorr
if [ $? = 0 ]; then
content="Deepfreeze home $directory success."
else
content="Deepfreeze home $directory failed."
fi
Xdialog --title "Header" --magbox "$content" $size
;;
Remove)
ask=`mktemp -q /tmp/menu.XXXXXX`
header="Deepfreeze ala Linux"
size="9 60"
content="Home folder you want to protect."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask
if [ ! $? = 0 ]; then
exit 0
fi
directory=`cat $ask`
If your distro doesn't use rc.d but init.d, You should change position of rc.local from /etc/rc.d/ to the right directory.
The last step is change the mode
chmod +x deepfreeze
Just double cliks it to activate. Or type in your console
sh deepfreeze
.