Subversion Repositories livecd

Rev

Rev 51 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51 Rev 52
Line 17... Line 17...
17
  rm -rf $TMPDIR
17
  rm -rf $TMPDIR
18
}
18
}
19
 
19
 
20
trap "clean_exit" EXIT
20
trap "clean_exit" EXIT
21
 
21
 
-
 
22
 
22
### ------------------------------------------------------------
23
### ------------------------------------------------------------
23
### Definitions
24
### Definitions
24
### ------------------------------------------------------------
25
### ------------------------------------------------------------
25
 
26
 
26
### set path and lang
27
### set path and lang
27
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"
28
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"
28
LANG=en_US.UTF-8
29
LANG=en_US.UTF-8
29
 
30
 
-
 
31
### define name of LiveCD install script
-
 
32
LIVECD_INSTALL=livecd-install
-
 
33
 
30
### title
34
### title and script name
31
TITLE="LiveCD Install GUI version $VERSION"
35
TITLE="LiveCD Install GUI version $VERSION"
32
MENU_TITLE="LiveCD Install GUI version $VERSION"
36
MENU_TITLE="LiveCD Install GUI version $VERSION"
-
 
37
SCRIPTNAME=$( basename $0 )
33
 
38
 
34
### tmpdir
39
### tmpdir
35
TMPDIR=/tmp/livecd-install-.$$
40
TMPDIR=/tmp/livecd-install-gui.$$
36
TMP=$TMPDIR/dialog
41
TMP=$TMPDIR/dialog
37
mkdir -p $TMPDIR
42
mkdir -p $TMPDIR
38
 
43
 
39
### dialog or xdialog?
44
### dialog or xdialog?
40
DIALOG="dialog"
45
DIALOG="dialog"
Line 47... Line 52...
47
### ------------------------------------------------------------
52
### ------------------------------------------------------------
48
### Functions
53
### Functions
49
### ------------------------------------------------------------
54
### ------------------------------------------------------------
50
 
55
 
51
 
56
 
52
 
-
 
53
### -------------------------------------------------------------
57
### -------------------------------------------------------------
54
about_message() {
58
about_message() {
55
 
59
 
56
    ABOUT_MESSAGE=$( cat <<EOF
60
    ABOUT_MESSAGE=$( cat <<EOF
57
-------------------------------------------\n
61
---------------------------------------\n
-
 
62
  $SCRIPTNAME\n
58
 $TITLE\n
63
  $TITLE\n
59
-------------------------------------------\n
64
---------------------------------------\n
60
 (C) 2007, Urs Beyerle, PSI\n
65
  (c) 2007, Urs Beyerle, PSI\n
61
\n
66
\n
62
 Press OK to continue\n
67
  Press OK to continue\n
63
EOF)
68
EOF)
64
 
-
 
65
    $DIALOG --title "$TITLE" --infobox "$ABOUT_MESSAGE" 15 60 8
69
    $DIALOG --title "$TITLE" --infobox "$ABOUT_MESSAGE" 15 60 8
66
    [ $? -ne 0 ] && exit
-
 
67
}
70
}
68
 
71
 
69
 
72
 
-
 
73
### -------------------------------------------------------------
-
 
74
help_message() {
-
 
75
 
-
 
76
    HELP_MESSAGE=$( cat <<EOF
-
 
77
   --------------------------------------------------------------------\n
-
 
78
     $SCRIPTNAME\n
-
 
79
     $TITLE\n
-
 
80
   --------------------------------------------------------------------\n
-
 
81
\n
-
 
82
This is the frontend of the $LIVECD_INSTALL script.
-
 
83
Use it to install the LiveCD/DVD on your hardisk.
-
 
84
\n\n
-
 
85
The LiveCD/DVD can be installed on a Linux
-
 
86
partition, which you may have to create first using tools
-
 
87
like qtparted, gparted, fdisk or parted. All data on the selected
-
 
88
Linux partition will be deleted. 
-
 
89
It is recommended to
-
 
90
create in addition a Swap partition that will be later
-
 
91
used by the installed Linux system.
-
 
92
\n\n
-
 
93
In order that you can boot into the installed Linux
-
 
94
system, it is recommended that you choose to install
-
 
95
the bootloader GRUB into the Master Boot Record (MBR)
-
 
96
of your primary boot disk.
-
 
97
\n\n
-
 
98
More options are available, if you run the script 
-
 
99
$LIVECD_INSTALL directly from the command line.
-
 
100
\n
-
 
101
EOF)
-
 
102
 
-
 
103
    $DIALOG --title "$TITLE" --infobox "$HELP_MESSAGE" 30 60 12
-
 
104
}
-
 
105
 
-
 
106
 
-
 
107
 
70
### ------------------------------------------------------------
108
### ------------------------------------------------------------
71
test_for_livecd_install_script() {
109
test_for_livecd_install_script() {
72
 
110
 
73
    LIVECD_INSTALL=$( which livecd-install 2>/dev/null )
111
    LIVECD_INSTALL_SCRIPT=$( which $LIVECD_INSTALL 2>/dev/null )
74
    if [ ! "$LIVECD_INSTALL" ]; then
112
    if [ ! "$LIVECD_INSTALL_SCRIPT" ]; then
75
	MESSAGE0="Script livecd-install not found"
113
	MESSAGE0="Script $LIVECD_INSTALL not found"
76
	$DIALOG --title "$TITLE" --msgbox "$MESSAGE0" 0 0
114
	$DIALOG --title "$TITLE" --msgbox "$MESSAGE0" 0 0
77
	exit 1
115
	exit 1
78
    fi
116
    fi
79
}
117
}
80
 
118
 
Line 132... Line 170...
132
    a=$( cat $TMP )
170
    a=$( cat $TMP )
133
    [ "$a" != "NONE" ] && echo $a
171
    [ "$a" != "NONE" ] && echo $a
134
    return 0
172
    return 0
135
}
173
}
136
 
174
 
-
 
175
 
137
### ------------------------------------------------------------
176
### ------------------------------------------------------------
138
ok_continue() {
177
ok_continue() {
139
 
178
 
140
    OK_MESSAGE="\nLiveCD will be installed on $INSTALL_PART.\n\
179
    OK_MESSAGE="\nLiveCD will be installed on $INSTALL_PART.\n\
141
All data on $INSTALL_PART will be deleted !!\n\n"
180
All data on $INSTALL_PART will be deleted !!\n\n"
Line 146... Line 185...
146
	OK_MESSAGE="${OK_MESSAGE}GRUB will be installed as bootloader into the\n\
185
	OK_MESSAGE="${OK_MESSAGE}GRUB will be installed as bootloader into the\n\
147
Master Boot Record (MBR) of disk $MBR_DISK.\n\n"
186
Master Boot Record (MBR) of disk $MBR_DISK.\n\n"
148
    fi
187
    fi
149
    OK_MESSAGE="${OK_MESSAGE}Is this ok ?\n"
188
    OK_MESSAGE="${OK_MESSAGE}Is this ok ?\n"
150
 
189
 
151
    $DIALOG --title "$TITLE" --yesno "$OK_MESSAGE" 15 60 8
190
    $DIALOG --title "$TITLE" --default-no --yesno "$OK_MESSAGE" 15 60 8
152
    return $?
191
    return $?
153
}
192
}
154
 
193
 
155
 
194
 
156
### ------------------------------------------------------------
195
### ------------------------------------------------------------
Line 185... Line 224...
185
 
224
 
186
 
225
 
187
### ------------------------------------------------------------
226
### ------------------------------------------------------------
188
run_livecd_install() {
227
run_livecd_install() {
189
 
228
 
190
    xterm -sb -title "Run: livecd-install -y $SWAP_PART_OPT $MBR_DISK_OPT $INSTALL_PART" \
229
    xterm -sb -title "Run: $LIVECD_INSTALL -y $SWAP_PART_OPT $MBR_DISK_OPT $INSTALL_PART" \
191
          -geometry 130x45+100+20 \
230
          -geometry 130x45+100+20 \
192
          -e 'echo; \
231
          -e 'echo; \
193
	      echo "Run: livecd-install -y $SWAP_PART_OPT $MBR_DISK_OPT $INSTALL_PART"; \
232
	      echo "Run: $LIVECD_INSTALL -y $SWAP_PART_OPT $MBR_DISK_OPT $INSTALL_PART"; \
-
 
233
	      echo; \
-
 
234
	      $LIVECD_INSTALL -y $SWAP_PART_OPT $MBR_DISK_OPT $INSTALL_PART; \
194
	      echo; \
235
	      echo; \
195
	      echo "livecd-install finished.";\
236
	      echo "$LIVECD_INSTALL finished.";\
196
	      echo;\
237
	      echo;\
197
	      echo "- Press a key to close this window -"; \
238
	      echo "- Press a key to close this window -"; \
198
	      read -n 1'
239
	      read -n 1'
199
}
240
}
200
 
241
 
Line 202... Line 243...
202
### ------------------------------------------------------------
243
### ------------------------------------------------------------
203
main_menu() {
244
main_menu() {
204
 
245
 
205
    MENU_1="Install the LiveCD"
246
    MENU_1="Install the LiveCD"
206
    MENU_2="Create Linux/Swap Partitions with qtparted"
247
    MENU_2="Create Linux/Swap Partitions with qtparted"
-
 
248
    MENU_3="Help"
207
    MENU_3="About"
249
    MENU_4="About"
208
    MENU_4="Quit"
250
    MENU_5="Quit"
209
    
251
    
210
    while true; do
252
    while true; do
211
	
253
	
212
	$DIALOG --title "$TITLE" \
254
	$DIALOG --title "$TITLE" \
213
	    --menu "$MENU_TITLE" 15 60 6\
255
	    --menu "$MENU_TITLE" 15 60 6\
214
	    1 "$MENU_1" \
256
	    1 "$MENU_1" \
215
	    2 "$MENU_2" \
257
	    2 "$MENU_2" \
216
	    3 "$MENU_3" \
258
	    3 "$MENU_3" \
217
	    4 "$MENU_4" \
259
	    4 "$MENU_4" \
-
 
260
	    5 "$MENU_5" \
218
	    2> $TMP
261
	    2> $TMP
219
 
262
 
220
	[ $? -ne 0 ] && break
263
	[ $? -ne 0 ] && break
221
 
264
 
222
	CHOICE=$(cat $TMP)
265
	CHOICE=$(cat $TMP)
Line 234... Line 277...
234
	   INSTALL_PART="" ;;
277
	   INSTALL_PART="" ;;
235
 
278
 
236
	 2)
279
	 2)
237
           run_qtparted ;;
280
           run_qtparted ;;
238
         3)
281
         3)
239
           about_message ;;
282
           help_message ;;
240
         4)
283
         4)
-
 
284
           about_message ;;
-
 
285
         5)
241
           exit ;;
286
           exit ;;
242
        esac
287
        esac
243
done
288
done
244
 
289
 
245
}
290
}
Line 253... Line 298...
253
test_for_livecd_install_script
298
test_for_livecd_install_script
254
test_for_root
299
test_for_root
255
 
300
 
256
### main menu
301
### main menu
257
main_menu
302
main_menu
258
[ $SWAP_PART ] && export SWAP_PART_OPT="-swap $SWAP_PART"
303
[ "$SWAP_PART" ] && export SWAP_PART_OPT="-swap $SWAP_PART"
259
[ $MBR_DISK ]  && export MBR_DISK_OPT="-mbr $MBR_DISK"
304
[ "$MBR_DISK" ]  && export MBR_DISK_OPT="-mbr $MBR_DISK"
260
export INSTALL_PART=$INSTALL_PART
305
export INSTALL_PART=$INSTALL_PART
-
 
306
export LIVECD_INSTALL=$LIVECD_INSTALL
261
 
307
 
262
### run livecd-install
308
### run $LIVECD_INSTALL
263
if [ $INSTALL_PART ]; then
309
if [ $INSTALL_PART ]; then
264
    run_livecd_install
310
    run_livecd_install
265
fi
311
fi
266
 
312