Anda di halaman 1dari 2

DeepFreeze di Ubuntu Linux

Sebenarnya ini bahasan basbang (basi banget). DeepFreeze di Linux relatif lebih mudah,
tinggal protect folder home dari user yg mau di protect, nanti tinggal bikin sekrip yg ngekstrak
ke home folder semula. begitu saya coba sesuai teori, hoala, ternyata ga terlalu mudah.
Googling sebentar, nemu sekrip nya om anjar hardiena, pentolan linux untuk warnet dg distro
zencafenya.

Sep lah, langsung kopi paste dan dijalankan. Ternyata masih banyak errornya. Mulai dari
sekeripnya yg emang error masalah kurang kutipan dan backslash, sekrip yg emang salah
karena kurang bebrapa baris perintah dan environment yg sedikit beda dg Ubuntu (om anjar
pake di linux yg slackware-based). Akhirnya setelah oprek sana sini, selesai lah sudah sekrip
nya yg saya kasih nama deepfreeze.3.

Pada intinya, skrip ini kasi dua pilihan. Install atau hapus. Kalau install, ditanya, home folder
mana yg mau di protect. Misalnya home folder utk user “test”, maka nanti sekrip menyimpan
folder /home/test di /home/test.tar.gz. Juga meng-update /etc/rc.local dimana ada perintah
untuk delete /home/test dan gantikan dg hasil ekstrak /home/test.tar.gz. Kalau meng-uninstall
deepfreeze, berati kebalikannya, yaitu delete /home/test.tar.gz, dan update /etc/rc.local.

Berikut ini sekripnya, selamat mencoba! Oiya, sekali lagi, ini dicoba di ubuntu dan pastikan
xdialog sudah terinstall. Menjalankannya dg user yg punya hak untuk melakukan sudo atau
root access dan file deepfreeze di chmod 755 (sudo chmod 755 deepfreeze.3). Misal (asumsi
kita berada satu folder dg sekrip deepfreeze.3): 'sudo ./deepfreeze.3" (tanpa tanda petik).

#!/bin/bash
# deepfreeze.3 - Deepfreeze a la Linux
# Backup before use, Use At Your Own Risk
# Copyleft 2007 by A. Hardiena
# Patched and modified for Ubuntu System by Hendro Wicaksono
(hendrowicaksono@yahoo.com)

Xdialog --title "Deepfreeze ala Linux" \


--menubox " Welcome to Deepfreeze ala Linux." 17 65 3 \
"Install" "Install Deepfreeze" \
"Hapus" "Hapus/Remove Deepfreeze" \
"Batal" "Batal/Abort Instalasi" 2>/tmp/checklist.tmp.$$

choice=`cat /tmp/checklist.tmp.$$`
rm -f /tmp/checklist.tmp.$$

case $choice in
"Install")

tanya=`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> $tanya
if [ ! $?= 0 ]; then
exit 0
fi

directori=`cat $tanya`
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")
tanya=`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> $tanya

if [ ! $? = 0 ]; then
exit 0
fi

directori=`cat $tanya`
sed -i "/# Deepfreeze/d" /etc/rc.local
rm /home/$directori.tar.gz
;;
esac

sumber : http://hendrowicaksono.multiply.com/journal/item/31/DeepFreeze_di_Ubuntu_Linux

Anda mungkin juga menyukai