Deep Freeze for Ubuntu,copy this script and save with deepfreeze.sh
#!/bin/bash
# Dippris - Deepfreeze ala GNU/Linux
# Jangan lupa diback up, kalau salah ndak tangung jawab
# Copyleft 2007 by A. Hardiena
# Patched and modified for Ubuntu System by yellowhat89@gmail.com
Xdialog --title "Deepfreeze khas GNU/Linux" \
--menubox " Selamat datang di Dippris." 17 65 3 \
"Install" "Install Dippris" \
"Hapus" "Hapus/Remove Dippris" \
"Batal" "Batal/Abort Instalasi" 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 yang mau di-protect?."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask
if [ ! $?= 0 ]; then
exit 0
fi
directori='cat $ask'
check='cat /etc/rc.local | grep '# Deepfreeze System''
temporary="# Deepfreeze System"
if [ "$check" == "$temporary" ]; then
sed -i "/# Deepfreeze/d" /etc/rc.local
rm /home/$directori.tar.gz
fi
# Processing Deepfreeze and put to /etc/rc.local
cd /home/
rm $directori.tar.gz
tar -cf $directori.tar $directori
gzip --best $directori.tar
sed 's/exit 0//g' /etc/rc.local > /tmp/rc.local.tmp
mv /tmp/rc.local.tmp /etc/rc.local
chmod 755 /etc/rc.local
cat << EOF >> /etc/rc.local
# Deepfreeze System
cd /home/ # Deepfreeze do not manual editing this line
rm -Rf /home/$directori # Deepfreeze do not manual editing this line
tar -xvvzf /home/$directori.tar.gz -C /home/ # Deepfreeze do not manual editing this line
# Deepfreeze has ended here
exit 0
EOF
# Check if autorecovery has errorr
if [ $? = 0 ]; then
content="Deepfreeze home $directori success."
else
content="Deepfreeze home $directori failed."
fi
Xdialog --title "Header" --msgbox "$content" $size
;;
"Hapus")
ask='mktemp -q /tmp/menu.XXXXXX'
header="Deepfreeze ala Linux"
size="9 60"
content="Home folder you want to un-deepfreeze."
Xdialog --title "$header" --inputbox "$content" $size 2> $ask
if [ ! $? = 0 ]; then
exit 0
fi
directori='cat $ask'
sed -i "/# Deepfreeze/d" /etc/rc.local
rm /home/$directori.tar.gz
;;
esac
using terminal,
sudo chmod 775 deepfreeze.sh
./deepfreeze.sh
Read more...
Subscribe to:
Posts (Atom)