-
Notifications
You must be signed in to change notification settings - Fork 0
/
xsr
95 lines (87 loc) · 2.1 KB
/
xsr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/sh
###Begin Info
# Name : XSisRestore
# Required software : xmessage
# Short-Description : X frontend for sisrestore
# Author / Copyright : Gian Giovani <wejick@gmail.com> wejick.wordpress.com
### END Info
# . /etc/sisrestore.conf
. /usr/sbin/SistemRestore.sh
#variable
status=$(head -1 /var/kompudini/sr/status)
if [ "$status" = "ENABLED" ]; then
stat="Disable"
en_dis(){
/usr/sbin/sisrestore disable
}
else
stat="Enable"
en_dis(){
/usr/sbin/sisrestore enable
}
fi
#start drawing ;)
xmessage -title "Sisrestore" -default about -buttons $stat:2,Restore:3,Configure:4,About:5,Exit:6-center "
status = $status
work mode = $wmode
archive mode = $amode
What do you want to do?
"
action=$?
if [ "$action" = 2 ]; then #enable-disable
xmessage -title "Sisrestore" -default No -buttons Yes:0,No:1 -center "Are you sure to do it?"
do=$?
if [ "$do" = 0 ]; then
en_dis
sleep 2
xmessage -title "Sisrestore" -center "
Finish
"
/usr/sbin/xsr
else
xmessage -title "Sisrestore" -center "
Aborted
"
fi
elif [ "$action" = 3 ]; then #Restore
xmessage -title "Sisrestore" -default No -buttons Yes:0,No:1 -center "Are you sure to restore?"
doit=$?
if [ "$doit" = 0 ]; then
do_res
sleep 2
xmessage -title "Sisrestore" -center "
Finish
"
/usr/sbin/xsr
else
xmessage -title "Sisrestore" -center "
Aborted
"/usr/sbin/xsr
fi
elif [ "$action" = 4 ]; then #Configuration
editor=$( which gnome-text-editor || which gedit || which leafpad || which mousepad)
if [ -x $(which zenity) ]; then
sh /usr/share/kompudini/sr/guided.sh conf
elif [ -x "$editor" ]; then
$editor /etc/sisrestore.conf
/usr/sbin/sisrestore reload
else
xmessage -title "Sisrestore" -center "Edit /etc/sisrestore.conf yourself"
fi
xmessage -title "Sisrestore" -center "
If you change target option or amode,
please disable and re enable to take effect."
/usr/sbin/xsr
elif [ "$action" = 5 ]; then #About
xmessage -title "Sisrestore" -center "
Sisrestore
Author Gian Giovani
wejick.wordpress.com
wejick@gmail.com
Feel free to contact me
Copyright 2010-2011 Gian Giovani
"
/usr/sbin/xsr
else
echo "canceled"
fi