DRBL/Clonezilla - 記錄客制化 / part1
再生龍live介面,功能選項其實蠻多的,因為需要符合多國使用者,萬不得已,有許多的相關設定。
那能否依照自已的需求,畫面 功能 自行客制化哩?
1. 畫面選項?
2. 功能選定?
3. 如何客制化進去?
分隔線
------------------------------------------------------------------------------------------------------'
測試已完成, 作個記錄吧
1. 編寫畫面功能
首先使用dialog功能 /
那能否依照自已的需求,畫面 功能 自行客制化哩?
1. 畫面選項?
2. 功能選定?
3. 如何客制化進去?
分隔線
------------------------------------------------------------------------------------------------------'
測試已完成, 作個記錄吧
1. 編寫畫面功能
首先使用dialog功能 /
#!/bin/bash
rm -r /home/123
home=/home/123
DIALOG=${DIALOG=dialog}
$DIALOG --separate-output --checklist \
"Select options:
1
2
3
4
5
6
7" 600 400 30 \
!!!! "Choice you want OS" on 1-1 "Windows7" off 1-2 "WindowsXP" off !!!! "Choice you want Restoreimage area" on \
2-1 "Only C:" off 2-2 "Re Disk" off !!!! "Choice you want Restoreimage Active" on 3-1 "reboot" off 3-2 "poweroff" off \
2>>$home
if [ $? -eq 1 ]; then
exit 0
sleep 100
fi
F=`cat $home | grep 1-`
G=`cat $home | grep 2-`
H=`cat $home | grep 3-`
if [ "$F" = "1-1" ]; then
A1=Windows7
elif [ "$F" = "1-2" ]; then
A1=WindowsXP
else
echo "dont choose two options or you dont have choose any OS"
sleep 5
echo "reboot"
fi
if [ "$G" = "2-1" ]; then
A2=sda1
elif [ "$G" = "2-2" ]; then
A2="sda1 sda3"
else
echo "dont choose two options or you dont have choose any Restoreimage area"
sleep 5
echo "reboot"
fi
if [ "$H" = "3-1" ]; then
A3=reboot
elif [ "$H" = "3-2" ]; then
A3=poweroff
else
echo "dont choose two options or you dont have choose any Restoreimage Active"
sleep 5
echo "reboot"
fi
if [ "$A1" = "WindowsXP" -a "$A2" = "sda1" ]; then
Source=XP
parts="restoreparts"
fi
if [ "$A1" = "WindowsXP" -a "$A2" = "sda1 sda3" ]; then
Source=XP
image="sda"
parts="restoredisk"
fi
if [ $A1 = "Windows7" -a "$A2" = "sda1" ]; then
Source=WIN7
parts="restoreparts"
fi
if [ $A1 = "Windows7" -a "$A2" = "sda1 sda3" ]; then
Source=WIN7
image="sda"
parts="restoredisk"
fi
if [ "$Source" = "XP" ]; then
MD5=MDXP
elif [ "$Source" = "WIN7" ]; then
MD5=MD7
else
echo ""
fi
if [ "$parts" = "restoreparts" ]; then
partsy="Only C:"
elif [ "$parts" = "restoredisk" ]; then
partsy="Re Disk"
else
echo " "
fi
if $DIALOG --title "Wellcome Use Auo Restore System" --yesno \
"Please Make sure you want to Restore Disk?
You choose OS is:`echo $A1`
You choose Restore Mode is:`echo $partsy`
You Restore Part is:`echo $A3`
1.`echo "please remember close PC PXE mode"`" 600 400 ; then
echo ""
else
exit
fi
if [ "$parts" == "restoredisk" ]; then
echo ""
DRIVE=$1
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
CYLINDERS=`echo $SIZE/255/63/512 | bc`
b=`echo $CYLINDERS/3 | bc`
c=$((${CYLINDERS} - ${b}))
{
echo ,$b,0x07,*
echo ,0,,-
echo ,$c,0x07,-
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS /dev/sda &> /dev/null
fi
echo /opt/drbl/sbin/ocs-sr -b -k -g auto -e1 auto -e2 -r -j2 -p $A3 $parts $Source $image
rm -r /home/123
home=/home/123
DIALOG=${DIALOG=dialog}
$DIALOG --separate-output --checklist \
"Select options:
1
2
3
4
5
6
7" 600 400 30 \
!!!! "Choice you want OS" on 1-1 "Windows7" off 1-2 "WindowsXP" off !!!! "Choice you want Restoreimage area" on \
2-1 "Only C:" off 2-2 "Re Disk" off !!!! "Choice you want Restoreimage Active" on 3-1 "reboot" off 3-2 "poweroff" off \
2>>$home
if [ $? -eq 1 ]; then
exit 0
sleep 100
fi
F=`cat $home | grep 1-`
G=`cat $home | grep 2-`
H=`cat $home | grep 3-`
if [ "$F" = "1-1" ]; then
A1=Windows7
elif [ "$F" = "1-2" ]; then
A1=WindowsXP
else
echo "dont choose two options or you dont have choose any OS"
sleep 5
echo "reboot"
fi
if [ "$G" = "2-1" ]; then
A2=sda1
elif [ "$G" = "2-2" ]; then
A2="sda1 sda3"
else
echo "dont choose two options or you dont have choose any Restoreimage area"
sleep 5
echo "reboot"
fi
if [ "$H" = "3-1" ]; then
A3=reboot
elif [ "$H" = "3-2" ]; then
A3=poweroff
else
echo "dont choose two options or you dont have choose any Restoreimage Active"
sleep 5
echo "reboot"
fi
if [ "$A1" = "WindowsXP" -a "$A2" = "sda1" ]; then
Source=XP
parts="restoreparts"
fi
if [ "$A1" = "WindowsXP" -a "$A2" = "sda1 sda3" ]; then
Source=XP
image="sda"
parts="restoredisk"
fi
if [ $A1 = "Windows7" -a "$A2" = "sda1" ]; then
Source=WIN7
parts="restoreparts"
fi
if [ $A1 = "Windows7" -a "$A2" = "sda1 sda3" ]; then
Source=WIN7
image="sda"
parts="restoredisk"
fi
if [ "$Source" = "XP" ]; then
MD5=MDXP
elif [ "$Source" = "WIN7" ]; then
MD5=MD7
else
echo ""
fi
if [ "$parts" = "restoreparts" ]; then
partsy="Only C:"
elif [ "$parts" = "restoredisk" ]; then
partsy="Re Disk"
else
echo " "
fi
if $DIALOG --title "Wellcome Use Auo Restore System" --yesno \
"Please Make sure you want to Restore Disk?
You choose OS is:`echo $A1`
You choose Restore Mode is:`echo $partsy`
You Restore Part is:`echo $A3`
1.`echo "please remember close PC PXE mode"`" 600 400 ; then
echo ""
else
exit
fi
if [ "$parts" == "restoredisk" ]; then
echo ""
DRIVE=$1
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
CYLINDERS=`echo $SIZE/255/63/512 | bc`
b=`echo $CYLINDERS/3 | bc`
c=$((${CYLINDERS} - ${b}))
{
echo ,$b,0x07,*
echo ,0,,-
echo ,$c,0x07,-
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS /dev/sda &> /dev/null
fi
echo /opt/drbl/sbin/ocs-sr -b -k -g auto -e1 auto -e2 -r -j2 -p $A3 $parts $Source $image
留言
張貼留言