rev |
line source |
domcox@599
|
1 #!/bin/sh
|
domcox@656
|
2 # tazinst - SliTaz GNU/Linux installer.
|
domcox@599
|
3 #
|
domcox@599
|
4 # So this is the SliTaz installer. The script starts with a
|
domcox@599
|
5 # few main variables, then all the functions and then the
|
domcox@599
|
6 # full sequence of functions.
|
domcox@599
|
7 #
|
domcox@683
|
8 # (C) 2007-2012 SliTaz - GNU General Public License v3.
|
domcox@599
|
9 #
|
domcox@599
|
10 # Authors : Christophe Lincoln <pankso@slitaz.org>
|
domcox@612
|
11 # Dominique Corbex <domcox@slitaz.org>
|
domcox@654
|
12 #
|
domcox@656
|
13 # Exit codes:
|
domcox@654
|
14 # 1: Parameters error
|
domcox@665
|
15 # 2: Setup file error
|
domcox@654
|
16 # 3: Source error
|
domcox@654
|
17 # 4: Cancelled by user
|
domcox@654
|
18 # 5: Target partition error
|
domcox@656
|
19 # 6: SliTaz system to upgrade not found
|
domcox@665
|
20 # 7: Another instance is running
|
domcox@654
|
21 # 8: Internal error
|
domcox@599
|
22
|
domcox@683
|
23 VERSION=3.31
|
domcox@655
|
24
|
domcox@655
|
25 # Internationalization
|
domcox@655
|
26 . /usr/bin/gettext.sh
|
domcox@655
|
27 TEXTDOMAIN='tazinst'
|
domcox@655
|
28 export TEXTDOMAIN
|
domcox@612
|
29
|
domcox@599
|
30 SOURCE_ROOT=/media/source
|
domcox@599
|
31 TARGET_ROOT=/mnt/target
|
domcox@599
|
32 LOG=/var/log/tazinst.log
|
domcox@665
|
33 LOCK=/run/tazinst.pid
|
domcox@599
|
34 BACKLIST="SliTaz GNU/Linux installer"
|
domcox@599
|
35
|
domcox@654
|
36 # DEBUG=1: Enable debug msgs
|
domcox@599
|
37 DEBUG=0
|
domcox@599
|
38
|
domcox@654
|
39 # Predefined urls
|
domcox@612
|
40 URL_STABLE="http://mirror.slitaz.org/iso/stable/slitaz-4.0.iso"
|
domcox@599
|
41 URL_COOKING="http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso"
|
domcox@599
|
42 URL_ROLLING="http://mirror.slitaz.org/iso/rolling/slitaz-core.iso"
|
domcox@599
|
43
|
domcox@665
|
44 # Tazinst conf
|
domcox@656
|
45 [ -r /etc/slitaz/tazinst.conf ] && . /etc/slitaz/tazinst.conf
|
domcox@656
|
46
|
domcox@599
|
47 # Print a short help
|
domcox@599
|
48 usage()
|
domcox@599
|
49 {
|
domcox@665
|
50 cat <<EOT
|
domcox@665
|
51 $(echo -e "\n$(gettext "Tazinst - SliTaz installer - Version"): $VERSION")
|
domcox@665
|
52
|
domcox@665
|
53 $(echo -e "\033[1m$(gettext "Usage"):\033[0m $(gettext "tazinst [command] [setup-file|url-shortcut]")")
|
domcox@665
|
54
|
domcox@665
|
55 $(echo -e "\033[1m$(gettext "Commands"): \033[0m")
|
domcox@665
|
56 usage|help $(gettext "Print this short usage.")
|
domcox@665
|
57 install <file> $(gettext "Install SliTaz on HDD using setup file contents.")
|
domcox@665
|
58 upgrade <file> $(gettext "Upgrade SliTaz on HDD using setup file contents.")
|
domcox@665
|
59 new <file> $(gettext "Create a new setup file.")
|
domcox@665
|
60 check <file> $(gettext "Check validity of settings in a setup file.")
|
domcox@665
|
61 showurl <shortcut> $(gettext "Show full URL of a predefined shortcut (stable|cooking|rolling).")
|
domcox@665
|
62 log $(gettext "Display log file contents and exit.")
|
domcox@665
|
63 version $(gettext "Print version and exit.")
|
domcox@665
|
64 EOT
|
domcox@665
|
65 exit 1
|
domcox@599
|
66 }
|
domcox@599
|
67
|
domcox@599
|
68 # Print an error msg & exit
|
domcox@599
|
69 # $1: exit code
|
domcox@599
|
70 # $@: err msg
|
domcox@599
|
71 abort()
|
domcox@599
|
72 {
|
domcox@599
|
73 # unmouting source & target
|
domcox@599
|
74 if mount | grep -q $SOURCE_ROOT; then
|
domcox@599
|
75 umount $SOURCE_ROOT 2>>$LOG
|
domcox@599
|
76 fi
|
domcox@599
|
77 if mount | grep -q $TARGET_ROOT; then
|
domcox@599
|
78 umount $TARGET_ROOT 2>>$LOG
|
domcox@599
|
79 fi
|
domcox@665
|
80 # rm lock
|
domcox@665
|
81 rm -f $LOCK
|
domcox@665
|
82
|
domcox@665
|
83 echo -e "$(gettext "Error") $@"
|
paul@608
|
84 test $(id -u) = 0 && echo "Installation cancelled on error $@" >> $LOG
|
domcox@599
|
85 exit $1
|
domcox@599
|
86 }
|
domcox@599
|
87
|
domcox@599
|
88 # Print a warning msg
|
domcox@599
|
89 warning()
|
domcox@599
|
90 {
|
domcox@665
|
91 echo -e "$(gettext "Warning:") $@" | tee -a $LOG
|
domcox@599
|
92 }
|
domcox@599
|
93
|
domcox@599
|
94 # Print a debug msg
|
domcox@599
|
95 debug()
|
domcox@599
|
96 {
|
domcox@665
|
97 [ $DEBUG -gt 0 ] && echo -e "\033[1mDEBUG:\033[0m $1"
|
domcox@665
|
98 [ $DEBUG -gt 0 ] && echo "DEBUG: $1" >>$LOG
|
domcox@599
|
99 }
|
domcox@599
|
100
|
domcox@665
|
101 # Print a simple msg
|
domcox@599
|
102 msg()
|
domcox@599
|
103 {
|
domcox@599
|
104 STEP=$(($STEP+1))
|
domcox@599
|
105 echo "$STEP. $@" | tee -a $LOG
|
domcox@665
|
106 sleep 1
|
domcox@599
|
107 }
|
domcox@599
|
108
|
domcox@665
|
109 #######################
|
domcox@665
|
110 # New setup functions #
|
domcox@665
|
111 #######################
|
domcox@599
|
112
|
domcox@665
|
113 # Generate a setup file
|
domcox@665
|
114 # $1: Setup file
|
domcox@665
|
115 gen_setup()
|
domcox@599
|
116 {
|
domcox@665
|
117 SETUP=$1
|
domcox@665
|
118 touch $SETUP || abort 2 $(gettext "Can't write setup file")
|
domcox@665
|
119 if [ -r "$SETUP" ]; then
|
domcox@665
|
120 cat > $SETUP << _EOF_
|
domcox@665
|
121 # SliTaz Installer setup file.
|
domcox@599
|
122 #
|
domcox@599
|
123
|
domcox@599
|
124 # Install type : [cdrom|usb|iso|web|weboot]
|
domcox@599
|
125 INST_TYPE="cdrom"
|
domcox@599
|
126
|
domcox@599
|
127 # Install source
|
domcox@599
|
128 # usb:/dev/xxx, ex: SRC_FILE=/dev/sdb1
|
domcox@599
|
129 # iso:file.iso, ex: SRC_FILE=~/slitaz.3.0.iso
|
domcox@599
|
130 # web: url, ex: SRC_FILE=http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso
|
paul@618
|
131 # web: predefined mirrors (stable|cooking|rolling), ex: SRC_FILE=cooking
|
domcox@599
|
132 SRC_FILE=""
|
domcox@599
|
133
|
pankso@692
|
134 # Install Target (Root Partition, ex /dev/hda5).
|
pankso@692
|
135 TGT_PARTITION=""
|
domcox@599
|
136
|
domcox@599
|
137 # Target File system.
|
domcox@599
|
138 # SliTaz uses ext3 by default but another filesystem can be used if wanted,
|
domcox@599
|
139 # for this please adjust your /etc/fstab after installation. Valid options are:
|
domcox@599
|
140 # (btrfs|ext2|ext3|ext4|fat16|fat32|hfs|hfs+|jfs|ntfs|reiser4|reiserfs|ufs|xfs)
|
domcox@599
|
141 TGT_FS="ext3"
|
domcox@599
|
142
|
domcox@599
|
143 # Home partition.
|
domcox@599
|
144 # On most GNU/Linux systems users personal files are stored in the directory
|
paul@618
|
145 # /home. Home can be on another hard disk or on a separate partition.
|
domcox@599
|
146 TGT_HOME=""
|
domcox@599
|
147 # Home File system (if /home is on a separate partition)
|
domcox@599
|
148 TGT_HOME_FS=""
|
domcox@599
|
149
|
domcox@599
|
150 # Hostname
|
domcox@599
|
151 TGT_HOSTNAME="slitaz"
|
domcox@599
|
152
|
domcox@599
|
153 # root password
|
domcox@599
|
154 # The root administrator privilege lets you manage and configure the full
|
domcox@599
|
155 # system. A root user can damage your system so you should always setup a
|
domcox@599
|
156 # strong password with special characters and/or numbers.
|
domcox@599
|
157 TGT_ROOT_PWD="root"
|
domcox@599
|
158
|
domcox@599
|
159 # The default user for the system will have his personal files stored
|
domcox@599
|
160 # in /home/*user* (and will be automatically added to the audio group).
|
domcox@599
|
161 TGT_USER="tux"
|
domcox@599
|
162 TGT_USER_PWD=""
|
domcox@599
|
163
|
domcox@599
|
164 # Grub bootloader
|
domcox@599
|
165 # install grub [yes|no]
|
domcox@599
|
166 TGT_GRUB="no"
|
domcox@599
|
167
|
domcox@599
|
168 # Windows dual-boot
|
domcox@599
|
169 # Dual boot is disabled if WINBOOT is empty: TGT_WINBOOT=""
|
domcox@599
|
170 # You may let tazinst find your win partition, mode=auto: TGT_WINBOOT="auto"
|
paul@618
|
171 # or use manual setting: "hd[disk],[partition]" ex:TGT_WINBOOT=hd0,0
|
domcox@599
|
172 TGT_WINBOOT=""
|
domcox@599
|
173
|
domcox@599
|
174 _EOF_
|
domcox@599
|
175
|
domcox@599
|
176 else
|
domcox@665
|
177 abort 2 $(gettext "Setup file not found")
|
domcox@599
|
178 fi
|
domcox@599
|
179 }
|
domcox@599
|
180
|
domcox@599
|
181 ######################
|
domcox@599
|
182 # Checking functions #
|
domcox@599
|
183 ######################
|
domcox@599
|
184
|
domcox@599
|
185 # def values and start log
|
domcox@599
|
186 # $@ :
|
domcox@599
|
187 init()
|
domcox@599
|
188 {
|
domcox@665
|
189 # Check if another instance of tazinst is running
|
domcox@665
|
190 if [ -e "$LOCK" ]; then
|
domcox@665
|
191 echo $(gettext "Another instance of tazinst is running.")
|
domcox@665
|
192 exit 7
|
domcox@665
|
193 else
|
domcox@665
|
194 echo $$ > $LOCK
|
domcox@665
|
195 fi
|
domcox@665
|
196
|
domcox@660
|
197 echo "=== Tazinst: start at `date` ===" >$LOG
|
domcox@599
|
198 echo "Command: $0 $@" >>$LOG
|
domcox@660
|
199 debug $(fdisk -l | grep \/dev)
|
domcox@599
|
200
|
domcox@599
|
201 # Default Type
|
domcox@599
|
202 INST_TYPE=cdrom
|
domcox@599
|
203 # Default Hostname.
|
domcox@599
|
204 TGT_HOSTNAME=slitaz
|
domcox@599
|
205 # Default root passwd
|
domcox@599
|
206 TGT_ROOT_PWD=root
|
domcox@599
|
207 # Default user
|
domcox@599
|
208 TGT_USER=tux
|
domcox@599
|
209 # Default Grub Install
|
domcox@599
|
210 TGT_GRUB=no
|
domcox@599
|
211 }
|
domcox@599
|
212
|
domcox@665
|
213 # Read setup
|
domcox@665
|
214 # $1: setup file
|
domcox@665
|
215 read_setup_file()
|
domcox@599
|
216 {
|
domcox@665
|
217 SETUP=$1
|
domcox@665
|
218 if [ -n "$SETUP" ]; then
|
domcox@665
|
219 if [ -r "$SETUP" ]; then
|
domcox@665
|
220 debug "Using setup-file=$SETUP"
|
domcox@599
|
221 # source doesn't like file without a path
|
domcox@665
|
222 [ $(echo "$SETUP" | grep -c "/") == "0" ] && SETUP="./$SETUP"
|
domcox@665
|
223 source $SETUP || abort 2 $(gettext "Unable to read setup file")
|
domcox@599
|
224 else
|
domcox@665
|
225 abort 2 $(gettext "Setup file not found")
|
domcox@599
|
226 fi
|
domcox@599
|
227 else
|
domcox@665
|
228 abort 2 $(gettext "No setup file provided")
|
domcox@599
|
229 fi
|
domcox@599
|
230 }
|
domcox@599
|
231
|
domcox@599
|
232 # check main vars
|
domcox@599
|
233 check_vars()
|
domcox@599
|
234 {
|
domcox@599
|
235 # error handling
|
domcox@599
|
236 local error=no
|
domcox@599
|
237 local found=no
|
domcox@599
|
238 local partition=""
|
domcox@599
|
239
|
domcox@599
|
240 debug "--- Tazinst main options ---"
|
domcox@599
|
241 debug "action=$INST_ACTION"
|
domcox@599
|
242 debug "type=$INST_TYPE"
|
domcox@599
|
243 debug "source=$SRC_FILE"
|
domcox@599
|
244 debug "/ partition=$TGT_PARTITION"
|
domcox@599
|
245 debug "/ filesystem=$TGT_FS"
|
domcox@599
|
246 debug "/home partition=$TGT_HOME"
|
domcox@599
|
247 debug "/home filesystem=$TGT_HOME_FS"
|
domcox@599
|
248 debug "hostname=$TGT_HOSTNAME"
|
domcox@599
|
249 debug "root-pwd=$TGT_ROOT_PWD"
|
domcox@599
|
250 debug "user=$TGT_USER"
|
domcox@599
|
251 debug "user-pwd=$TGT_USER_PWD"
|
domcox@599
|
252 debug "grub=$TGT_GRUB"
|
domcox@599
|
253 debug "winboot=$TGT_WINBOOT"
|
domcox@599
|
254 debug "--------------------------------------"
|
domcox@599
|
255
|
domcox@599
|
256 # Check Action
|
domcox@599
|
257 case $INST_ACTION in
|
domcox@656
|
258 install|upgrade|check) ;;
|
domcox@665
|
259 *) msg "$INST_ACTION: $(gettext "Unknown install mode")"; error=yes ;;
|
domcox@599
|
260 esac
|
domcox@599
|
261
|
domcox@599
|
262 # Check Type
|
domcox@599
|
263 case $INST_TYPE in
|
domcox@599
|
264 cdrom|weboot) ;;
|
domcox@599
|
265 usb|iso|web)
|
domcox@599
|
266 # We need a valid source
|
domcox@599
|
267 if [ -z "$SRC_FILE" ]; then
|
domcox@665
|
268 msg "$INST_TYPE: $(gettext "No source file provided")"; error=yes
|
domcox@599
|
269 fi ;;
|
domcox@665
|
270 *) msg "$INST_TYPE: $(gettext "Unknown source type")"; error=yes ;;
|
domcox@599
|
271 esac
|
domcox@599
|
272
|
domcox@599
|
273 # Check Source file
|
domcox@599
|
274 # 1. assign predefs
|
domcox@599
|
275 if [ "$INST_TYPE" == "web" ]; then
|
domcox@599
|
276 [ "$SRC_FILE" == "stable" ] && SRC_FILE=$URL_STABLE
|
domcox@599
|
277 [ "$SRC_FILE" == "cooking" ] && SRC_FILE=$URL_COOKING
|
domcox@599
|
278 [ "$SRC_FILE" == "rolling" ] && SRC_FILE=$URL_ROLLING
|
domcox@599
|
279 fi
|
domcox@599
|
280 # 2. check avail.
|
domcox@599
|
281 case $INST_TYPE in
|
domcox@599
|
282 iso)
|
domcox@599
|
283 if [ ! -r "$SRC_FILE" ]; then
|
domcox@665
|
284 msg "$SRC_FILE: $(gettext "Source file not found")"; error=yes
|
domcox@599
|
285 fi ;;
|
domcox@599
|
286 web)
|
domcox@656
|
287 if ! wget -sq "$SRC_FILE" 2> /dev/null ; then
|
domcox@665
|
288 msg "$SRC_FILE: $(gettext "URL not found")"; error=yes
|
domcox@599
|
289 fi ;;
|
domcox@599
|
290 esac
|
domcox@599
|
291
|
domcox@599
|
292 # Check Target Partition
|
domcox@599
|
293 found=no
|
domcox@599
|
294 LIST_PARTITION=$(fdisk -l | awk '/^\/dev/{printf "%s ",$1}')
|
domcox@599
|
295 for partition in $LIST_PARTITION; do
|
domcox@599
|
296 [ "$partition" == "$TGT_PARTITION" ] && found="yes"
|
domcox@599
|
297 done
|
domcox@599
|
298 if [ "$found" != "yes" ]; then
|
domcox@665
|
299 msg "$TGT_PARTITION: $(gettext "Partition for / not found")"; error=yes
|
domcox@599
|
300 fi
|
domcox@660
|
301 if [ "$TGT_PARTITION" == "$SRC_FILE" ]; then
|
domcox@665
|
302 msg $(gettext "Target and source partitions should be different"); error=yes
|
domcox@660
|
303 fi
|
domcox@599
|
304
|
domcox@599
|
305 # Check Filesystem
|
domcox@599
|
306 case $TGT_FS in
|
domcox@599
|
307 "") ;;
|
domcox@599
|
308 btrfs|ext2|ext3|ext4|fat16|fat32|hfs|hfs+|jfs|ntfs|reiser4|reiserfs|ufs|xfs)
|
domcox@599
|
309 found=no
|
domcox@599
|
310 for xdir in /sbin /usr/sbin /usr/bin; do
|
domcox@599
|
311 [ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
|
domcox@599
|
312 done
|
domcox@599
|
313 if [ "$found" == "no" ]; then
|
domcox@665
|
314 msg "$TGT_FS: mkfs.$TGT_FS $(gettext "is not installed")"; error=yes
|
domcox@599
|
315 fi ;;
|
domcox@665
|
316 *) msg "$TGT_FS: $(gettext "Unknown filesystem (/)")"; error=yes ;;
|
domcox@599
|
317 esac
|
domcox@599
|
318
|
domcox@599
|
319 # Check Home partition
|
domcox@599
|
320 if [ -n "$TGT_HOME" ]; then
|
domcox@599
|
321 found=no
|
domcox@599
|
322 for partition in $LIST_PARTITION; do
|
domcox@599
|
323 [ "$partition" == "$TGT_HOME" ] && found=yes
|
domcox@599
|
324 done
|
domcox@599
|
325 if [ "$found" != "yes" ]; then
|
domcox@665
|
326 msg "$TGT_HOME: $(gettext "Partition for /home not found")"; error=yes
|
domcox@599
|
327 fi
|
domcox@660
|
328 if [ "$TGT_HOME" == "$SRC_FILE" ]; then
|
domcox@665
|
329 msg $(gettext "/home and source partitions should be different"); error=yes
|
domcox@660
|
330 fi
|
domcox@660
|
331 if [ "$TGT_HOME" == "$TGT_PARTITION" ]; then
|
domcox@665
|
332 msg $(gettext "/ and /home partitions should be different"); error=yes
|
domcox@660
|
333 fi
|
domcox@599
|
334 fi
|
domcox@599
|
335
|
domcox@599
|
336 # Check Home Filesystem
|
domcox@599
|
337 case $TGT_HOME_FS in
|
domcox@599
|
338 "") ;;
|
domcox@599
|
339 btrfs|ext2|ext3|ext4|fat16|fat32|hfs|hfs+|jfs|ntfs|reiser4|reiserfs|ufs|xfs)
|
domcox@599
|
340 found=no
|
domcox@599
|
341 for xdir in /sbin /usr/sbin /usr/bin; do
|
domcox@599
|
342 [ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
|
domcox@599
|
343 done
|
domcox@599
|
344 if [ "$found" == "no" ]; then
|
domcox@665
|
345 msg "$TGT_FS: mkfs.$TGT_FS $(gettext "is not installed")"; error=yes
|
domcox@599
|
346 fi ;;
|
domcox@665
|
347 *) msg "$TGT_HOME_FS: $(gettext "Unknown filesystem (/home)")"; error=yes ;;
|
domcox@599
|
348 esac
|
domcox@599
|
349
|
domcox@599
|
350 # Check Grub
|
domcox@599
|
351 case $TGT_GRUB in
|
domcox@599
|
352 yes|no) ;;
|
domcox@665
|
353 *) msg $(gettext "Bootloader (grub): Invalid settings"); error=yes ;;
|
domcox@599
|
354 esac
|
domcox@599
|
355
|
domcox@599
|
356 # Check Winboot
|
domcox@599
|
357 case $TGT_WINBOOT in
|
domcox@599
|
358 "") ;;
|
domcox@599
|
359 auto) ;;
|
domcox@599
|
360 hd[[:digit:]],[[:digit:]]) ;;
|
domcox@665
|
361 *) msg $(gettext "Windows Dual-Boot: Invalid settings"); error=yes ;;
|
domcox@599
|
362 esac
|
domcox@599
|
363
|
domcox@599
|
364 # Stop on error
|
domcox@599
|
365 [ "$error" == "yes" ] && abort 1
|
domcox@599
|
366 }
|
domcox@599
|
367
|
domcox@599
|
368 # Exit install if user is not root.
|
domcox@599
|
369 check_root()
|
domcox@599
|
370 {
|
domcox@599
|
371 if test $(id -u) != 0 ; then
|
domcox@665
|
372 gettext "You must be the root user (system administrator) to install SliTaz, \
|
domcox@665
|
373 please use 'su' to get a root SHell and restart installation."
|
domcox@599
|
374 exit 0
|
domcox@599
|
375 fi
|
domcox@599
|
376 }
|
domcox@599
|
377
|
domcox@599
|
378 # Mount cdrom
|
domcox@599
|
379 check_cdrom()
|
domcox@599
|
380 {
|
domcox@599
|
381 # Set device name
|
domcox@599
|
382 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` [ -n "$DRIVE_NAME" ] || DRIVE_NAME=cdrom
|
domcox@599
|
383 CDROM=/dev/$DRIVE_NAME
|
domcox@599
|
384 # Try to mount a cdrom
|
domcox@599
|
385 if mount -t iso9660 $CDROM $SOURCE_ROOT 2>>$LOG; then
|
domcox@599
|
386 debug "Using files from cdrom ($CDROM)..."
|
domcox@599
|
387 sleep 2
|
domcox@599
|
388 else
|
domcox@665
|
389 warning "$CDROM: $(gettext "Mount failed")"
|
domcox@599
|
390 fi
|
domcox@599
|
391 }
|
domcox@599
|
392
|
domcox@599
|
393 # Link LiveUSB
|
domcox@599
|
394 check_usb()
|
domcox@599
|
395 {
|
domcox@599
|
396 # /home is on USB dev
|
domcox@599
|
397 if [ -d /home/boot ]; then
|
domcox@599
|
398 debug "Using files from USB device..."
|
domcox@599
|
399 ln -s /home/boot $SOURCE_ROOT/boot
|
domcox@599
|
400 SOURCE_STATUS="link"
|
domcox@599
|
401 sleep 2
|
domcox@599
|
402 else
|
domcox@599
|
403 # Try to mount LiveUSB
|
domcox@599
|
404 if mount $SRC_FILE $SOURCE_ROOT 2>>$LOG; then
|
domcox@599
|
405 debug "Using files from USB device ($SRC_FILE)..."
|
domcox@599
|
406 SOURCE_STATUS="mount"
|
domcox@599
|
407 else
|
domcox@665
|
408 warning "$SRC_FILE: $(gettext "Failed to mount USB device")"
|
domcox@599
|
409 fi
|
domcox@599
|
410 fi
|
domcox@599
|
411 }
|
domcox@599
|
412
|
domcox@599
|
413 # Mount ISO file
|
domcox@599
|
414 check_iso()
|
domcox@599
|
415 {
|
domcox@599
|
416 local src_md5
|
domcox@599
|
417 # Integrity check
|
domcox@599
|
418 src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
|
domcox@599
|
419 if [ -r "$src_md5" ]; then
|
domcox@599
|
420 [ $(md5sum $SRC_FILE | cut -d' ' -f1) == $(cat "$src_md5" | cut -d' ' -f1) ] || \
|
domcox@665
|
421 abort 3 "$SRC-FILE: $(gettext "md5sum mismatch, file corrupted")"
|
domcox@599
|
422 else
|
domcox@665
|
423 warning "$SRC_FILE: $(gettext "md5 file not found, unable to check integrity.")"
|
domcox@599
|
424 fi
|
domcox@599
|
425 # Try to mount ISO
|
domcox@599
|
426 if mount -o loop -t iso9660 $SRC_FILE $SOURCE_ROOT 2>>$LOG; then
|
domcox@599
|
427 debug "Using files from ISO ($SRC_FILE)..."
|
domcox@599
|
428 sleep 2
|
domcox@599
|
429 else
|
domcox@665
|
430 warning "$SRC_FILE: $(gettext "Failed to mount ISO.")"
|
domcox@599
|
431 fi
|
domcox@599
|
432 }
|
domcox@599
|
433
|
domcox@599
|
434 # Source is on the web
|
domcox@599
|
435 check_web()
|
domcox@599
|
436 {
|
domcox@599
|
437 local src_md5
|
domcox@599
|
438 debug "Downloading $SRC_FILE"
|
domcox@599
|
439 if wget $SRC_FILE -P /tmp; then
|
domcox@599
|
440 debug "Download completed."
|
domcox@599
|
441 else
|
domcox@665
|
442 warning "$SRC_FILE: $(gettext "File download failed.")"
|
domcox@599
|
443 fi
|
domcox@599
|
444 src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
|
domcox@599
|
445 debug "Downloading $src_md5"
|
domcox@665
|
446 wget $src_md5 -P /tmp || warning "$src_md5: $(gettext "File download failed.")"
|
domcox@599
|
447 tmpfile=$(echo $SRC_FILE | awk 'BEGIN{RS="/"}{out=$1}END{printf"%s",out}')
|
domcox@599
|
448 SRC_FILE="/tmp/$tmpfile"
|
domcox@599
|
449 check_iso
|
domcox@599
|
450 }
|
domcox@599
|
451
|
domcox@599
|
452 # We may be in Tiny Web boot mode
|
domcox@599
|
453 check_weboot()
|
domcox@599
|
454 {
|
domcox@599
|
455 if [ -d $SRC_FILE/boot ]; then
|
domcox@599
|
456 debug "Using files from HTTP device..."
|
domcox@599
|
457 ln -s $SRC_FILE/boot $SOURCE_ROOT/boot
|
domcox@599
|
458 sleep 2
|
domcox@599
|
459 else
|
domcox@665
|
460 abort 3 $(gettext "Web boot files not found")
|
domcox@599
|
461 fi
|
domcox@599
|
462 }
|
domcox@599
|
463
|
domcox@599
|
464 # set up source and check Slitaz' content
|
domcox@599
|
465 check_source()
|
domcox@599
|
466 {
|
domcox@599
|
467 debug "Creating mount point ($SOURCE_ROOT)..."
|
domcox@599
|
468 mkdir -p $SOURCE_ROOT
|
domcox@599
|
469 sleep 1
|
domcox@599
|
470 case $INST_TYPE in
|
domcox@599
|
471 cdrom)
|
domcox@599
|
472 check_cdrom ;;
|
domcox@599
|
473 usb)
|
domcox@599
|
474 check_usb ;;
|
domcox@599
|
475 iso)
|
domcox@599
|
476 check_iso ;;
|
domcox@599
|
477 web)
|
domcox@599
|
478 check_web ;;
|
domcox@599
|
479 weboot)
|
domcox@599
|
480 check_cdrom
|
domcox@599
|
481 check_web ;;
|
domcox@599
|
482 *)
|
domcox@665
|
483 abort 8 $(gettext "Internal") ;;
|
domcox@599
|
484 esac
|
domcox@599
|
485
|
domcox@599
|
486 # Exit with error msg if no rootfs.gz found.
|
domcox@599
|
487 debug "Checking installation media..."
|
domcox@599
|
488 if [ ! -f $SOURCE_ROOT/boot/rootfs.gz -a \
|
domcox@599
|
489 ! -f $SOURCE_ROOT/boot/rootfs1.gz ]; then
|
domcox@665
|
490 abort 3 $(gettext "Invalid source")
|
domcox@599
|
491 else
|
domcox@599
|
492 debug "Installation media checked ok"
|
domcox@599
|
493 fi
|
domcox@599
|
494 }
|
domcox@599
|
495
|
domcox@599
|
496 #######################
|
domcox@599
|
497 # Installer functions #
|
domcox@599
|
498 #######################
|
domcox@599
|
499
|
domcox@599
|
500 # Mount and mkfs with progress.
|
domcox@599
|
501 prepare_install()
|
domcox@599
|
502 {
|
domcox@599
|
503 debug "Preparing target partition..."
|
domcox@612
|
504 # Target may be used
|
domcox@612
|
505 mount | grep -q $TGT_PARTITION && \
|
domcox@665
|
506 abort 5 "$TGT_PARTITION: $(gettext "Partition in use")"
|
domcox@599
|
507 # Mount point can be already used.
|
domcox@599
|
508 if mount | grep -q $TARGET_ROOT; then
|
domcox@599
|
509 umount $TARGET_ROOT 2>>$LOG
|
domcox@599
|
510 fi
|
domcox@599
|
511 sleep 2
|
domcox@599
|
512
|
domcox@599
|
513 # Formatting root partition
|
domcox@599
|
514 case $TGT_FS in
|
domcox@599
|
515 "")
|
domcox@599
|
516 debug "The partition ($TGT_PARTITION) will be cleaned..."
|
domcox@599
|
517 # ROOT_FS=$(parted /dev/hda5 print -m | grep "^1:" | cut -d':' -f5) ;;
|
domcox@599
|
518 ROOT_FS=auto ;;
|
domcox@599
|
519 *)
|
domcox@665
|
520 msg "$(gettext "Formatting / partition:") $TGT_PARTITION ($TGT_FS)"
|
domcox@599
|
521 mkfs.$TGT_FS $TGT_PARTITION >>$LOG 2>>$LOG
|
domcox@599
|
522 ROOT_FS=$TGT_FS ;;
|
domcox@599
|
523 esac
|
domcox@599
|
524 sleep 2
|
domcox@599
|
525
|
domcox@599
|
526 # Formatting /home
|
domcox@599
|
527 if [ -n "$TGT_HOME" ]; then
|
domcox@599
|
528 case $TGT_HOME_FS in
|
domcox@599
|
529 "")
|
domcox@599
|
530 debug "The partition ($TGT_HOME) will be kept..." ;;
|
domcox@599
|
531 *)
|
domcox@665
|
532 msg "$(gettext "Formatting /home partition:") $TGT_HOME ($TGT_HOME_FS)"
|
domcox@599
|
533 mkfs.$TGT_HOME_FS -L "Home" $TGT_HOME >>$LOG 2>>$LOG ;;
|
domcox@599
|
534 esac
|
domcox@599
|
535 sleep 2
|
domcox@599
|
536 fi
|
domcox@599
|
537
|
domcox@599
|
538 # Mount target.
|
domcox@599
|
539 debug "Creating mount point: $TARGET_ROOT"
|
domcox@599
|
540 mkdir -p $TARGET_ROOT >>$LOG
|
domcox@599
|
541 sleep 2
|
domcox@599
|
542
|
domcox@599
|
543 mount -t $ROOT_FS $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
|
domcox@599
|
544 if [ $(mount | grep -c "mnt/target") == "0" ]; then
|
domcox@665
|
545 abort 5 "$TGT_PARTITION: $(gettext "Unable to mount partition")"
|
domcox@599
|
546 fi
|
domcox@599
|
547 }
|
domcox@599
|
548
|
domcox@599
|
549 # Get a clean target device (15%).
|
domcox@599
|
550 clean_target()
|
domcox@599
|
551 {
|
domcox@599
|
552 if [ -z "$TGT_FS" ]; then
|
domcox@599
|
553 # partition was not formatted
|
domcox@599
|
554 debug "Cleaning the root partition ($TGT_PARTITION)..."
|
domcox@599
|
555 # Keep /home in case of reinstall.
|
domcox@665
|
556 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
557 for dir in *
|
domcox@599
|
558 do
|
domcox@599
|
559 case "$dir" in
|
domcox@599
|
560 home)
|
domcox@599
|
561 debug "keeping /home found on: $TGT_PARTITION"
|
domcox@599
|
562 mv home home.bak ;;
|
domcox@599
|
563 lost+found)
|
domcox@599
|
564 continue ;;
|
domcox@599
|
565 *)
|
domcox@599
|
566 debug "removing target: $dir"
|
domcox@599
|
567 rm -rf $dir 2>>$LOG ;;
|
domcox@599
|
568 esac
|
domcox@599
|
569 done
|
domcox@599
|
570 if [ -d mklost+found ]; then
|
domcox@599
|
571 mklost+found 2>>$LOG
|
domcox@599
|
572 fi
|
domcox@599
|
573 fi
|
domcox@599
|
574 sleep 2
|
domcox@599
|
575 }
|
domcox@599
|
576
|
domcox@599
|
577 # Kernel is renamed to standard vmlinuz-$VERSION.
|
domcox@599
|
578 install_kernel()
|
domcox@599
|
579 {
|
domcox@599
|
580 if [ -d /$TARGET_ROOT/lib/modules ]; then
|
domcox@599
|
581 KERNEL=$(ls /$TARGET_ROOT/lib/modules | tail -1)
|
domcox@599
|
582 KERNEL="vmlinuz-$KERNEL"
|
domcox@599
|
583 else
|
domcox@599
|
584 KERNEL=vmlinuz-`uname -r`
|
domcox@665
|
585 warning "$(gettext "Kernel name not found, falling back to:") $(uname -r)"
|
domcox@599
|
586 fi
|
domcox@599
|
587 mkdir -p $TARGET_ROOT/boot
|
domcox@599
|
588 cp $SOURCE_ROOT/boot/bzImage $TARGET_ROOT/boot/$KERNEL
|
domcox@599
|
589 debug "install_kernel: $KERNEL"
|
domcox@599
|
590 sleep 2
|
domcox@599
|
591 }
|
domcox@599
|
592
|
domcox@599
|
593 # Copy isolinux r/w files (not syslinux, some files are read only).
|
domcox@599
|
594 copy_bootloaders()
|
domcox@599
|
595 {
|
domcox@599
|
596 if [ -d "$SOURCE/ROOT/boot/isolinux" ]; then
|
domcox@599
|
597 debug "Copy isolinux r/w files"
|
domcox@599
|
598 mkdir -p $TARGET_ROOT/boot/isolinux
|
domcox@599
|
599 cp -a $SOURCE_ROOT/boot/isolinux/*.cfg $TARGET_ROOT/boot/isolinux
|
domcox@599
|
600 cp -a $SOURCE_ROOT/boot/isolinux/*.kbd $TARGET_ROOT/boot/isolinux
|
domcox@599
|
601 cp -a $SOURCE_ROOT/boot/isolinux/*.txt $TARGET_ROOT/boot/isolinux
|
domcox@599
|
602 cp -a $SOURCE_ROOT/boot/isolinux/*.bin $TARGET_ROOT/boot/isolinux
|
domcox@599
|
603 cp -a $SOURCE_ROOT/boot/isolinux/*.msg $TARGET_ROOT/boot/isolinux
|
domcox@599
|
604 cp -a $SOURCE_ROOT/boot/isolinux/*.lss $TARGET_ROOT/boot/isolinux
|
domcox@599
|
605 cp -a $SOURCE_ROOT/boot/isolinux/*.c32 $TARGET_ROOT/boot/isolinux
|
domcox@599
|
606 fi
|
pankso@679
|
607 # GRUB splash image
|
pascal@694
|
608 if [ -f "$SOURCE_ROOT/boot/grub/splash.xpm.gz" ]; then
|
pankso@679
|
609 debug "Copy GRUB splash image"
|
pankso@679
|
610 mkdir -p $TARGET_ROOT/boot/grub
|
pankso@693
|
611 $SOURCE_ROOT/boot/grub/splash.xpm.gz $TARGET_ROOT/boot/grub
|
pankso@679
|
612 fi
|
domcox@599
|
613 }
|
domcox@599
|
614
|
domcox@599
|
615 need_package()
|
domcox@599
|
616 {
|
domcox@599
|
617 [ -d /var/lib/tazpkg/installed/$1 ] || tazpkg get-install $1
|
domcox@599
|
618 }
|
domcox@599
|
619
|
domcox@599
|
620 # extract packed rootfs: squashfs or cromfs
|
domcox@599
|
621 extract_loramfs()
|
domcox@599
|
622 {
|
domcox@599
|
623 local i
|
domcox@599
|
624 for i in $(cpio -idvum 2> /dev/null); do
|
domcox@599
|
625 case "$i" in
|
domcox@599
|
626 rootfs*)
|
domcox@599
|
627 need_package squashfs
|
domcox@599
|
628 if ! unsquashfs $i ; then
|
domcox@599
|
629 need_package cromfs
|
domcox@599
|
630 unmkcromfs $i squashfs-root
|
domcox@599
|
631 fi
|
domcox@599
|
632 mv -f squashfs-root/* .
|
domcox@599
|
633 rmdir squashfs-root
|
domcox@599
|
634 rm -f $i
|
domcox@599
|
635 esac
|
domcox@599
|
636 done
|
domcox@599
|
637 }
|
domcox@599
|
638
|
domcox@599
|
639 # This is a loram rootfs.gz, skip loram bootstrap and extract
|
domcox@599
|
640 extract_first_loramfs()
|
domcox@599
|
641 {
|
domcox@599
|
642 (zcat $1 || unlzma -c $1) | cpio -i extractfs.cpio 2> /dev/null &&
|
domcox@599
|
643 ( cd / ; cpio -id ) < extractfs.cpio && rm -f extractfs.cpio
|
domcox@599
|
644 ofs=$(awk '/07070100/ { o+=index($0,"07070100"); printf "%d\n",o/4 ; exit } { o+=1+length() }' < $1)
|
domcox@599
|
645 dd if=$1 skip=$(($ofs / 1024)) bs=4k count=1 2> /dev/null | \
|
domcox@599
|
646 ( dd skip=$(($ofs % 1024)) bs=4 2> /dev/null ; \
|
domcox@599
|
647 dd if=$1 skip=$((1 + ($ofs / 1024) )) bs=4k ) | extract_loramfs
|
domcox@599
|
648 }
|
domcox@599
|
649
|
domcox@599
|
650 # Extract lzma'ed or gziped rootfs.
|
domcox@599
|
651 extract_rootfs()
|
domcox@599
|
652 {
|
domcox@599
|
653 local isloramfs
|
domcox@599
|
654 isloramfs=
|
domcox@665
|
655 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
656 if [ -d $1/../fs/etc ]; then
|
domcox@599
|
657 # This is a tazlitobox loram (cdrom)
|
domcox@599
|
658 cp -a $1/../fs/. .
|
domcox@599
|
659 else
|
domcox@599
|
660 for i in $(ls $1/rootfs* | sort -r); do
|
domcox@599
|
661 if [ ! -d etc ]; then
|
domcox@599
|
662 if [ $( (zcat $i 2>/dev/null || lzma d $i -so) | wc -c) \
|
domcox@599
|
663 -lt $(stat -c %s $i) ]; then
|
domcox@599
|
664 # This is a tazlitobox loram (ram)
|
domcox@599
|
665 isloramfs=$i
|
domcox@599
|
666 extract_first_loramfs $i
|
domcox@599
|
667 continue
|
domcox@599
|
668 fi
|
domcox@599
|
669 fi
|
domcox@599
|
670 if [ -n "$isloramfs" ]; then
|
domcox@599
|
671 extract_loramfs < $i
|
domcox@599
|
672 continue
|
domcox@599
|
673 fi
|
domcox@599
|
674 ( zcat $i 2>/dev/null || lzma d $i -so || \
|
domcox@599
|
675 cat $i ) 2>>$LOG | cpio -idu
|
domcox@599
|
676 done 2>>$LOG > /dev/null
|
domcox@599
|
677 fi
|
domcox@599
|
678 cp /etc/keymap.conf etc
|
domcox@599
|
679 # unpack /usr (double check...)
|
domcox@599
|
680 if ls etc/tazlito | grep -q ".extract"; then
|
domcox@599
|
681 for i in etc/tazlito/*.extract; do
|
domcox@599
|
682 [ -f "$i" ] && . $i /media/cdrom
|
domcox@599
|
683 done
|
domcox@599
|
684 fi
|
domcox@599
|
685 }
|
domcox@599
|
686
|
domcox@599
|
687 # Pre configure freshly installed system (60 - 80%).
|
domcox@599
|
688 pre_config_system()
|
domcox@599
|
689 {
|
domcox@665
|
690 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
691 # Restore backup of existing /home if exists.
|
domcox@599
|
692 # (created by prepare_target_dev)
|
domcox@599
|
693 if [ -d home.bak ]; then
|
domcox@599
|
694 debug "Restoring directory: /home..."
|
domcox@599
|
695 rm -rf home
|
domcox@599
|
696 mv home.bak home
|
domcox@599
|
697 sleep 1
|
domcox@599
|
698 fi
|
domcox@599
|
699 # Add root device to CHECK_FS in rcS.conf to check filesystem
|
domcox@599
|
700 # on each boot.
|
domcox@599
|
701 debug "Adding $TGT_PARTITION and CHECK_FS to file /etc/rcS.conf..."
|
domcox@599
|
702 sed -i s#'CHECK_FS=\"\"'#"CHECK_FS=\"$TGT_PARTITION\""# etc/rcS.conf
|
domcox@599
|
703 sleep 2
|
domcox@599
|
704 # Set hostname.
|
domcox@665
|
705 msg "$(gettext "Configuring host name:") $TGT_HOSTNAME"
|
domcox@599
|
706 echo $TGT_HOSTNAME > etc/hostname
|
domcox@599
|
707 }
|
domcox@599
|
708
|
domcox@599
|
709 # Set root passwd and create user after rootfs extraction.
|
domcox@599
|
710 users_settings()
|
domcox@599
|
711 {
|
domcox@599
|
712 cat > $TARGET_ROOT/users.sh << _EOF_
|
domcox@599
|
713 #!/bin/sh
|
domcox@665
|
714 echo "root:$TGT_ROOT_PWD" | chpasswd
|
domcox@599
|
715 adduser -D -H $TGT_USER
|
domcox@599
|
716
|
domcox@599
|
717 for grp in audio cdrom floppy dialout disk kmem tape tty video; do
|
domcox@599
|
718 if ! grep \$grp /etc/group | grep -q $TGT_USER ; then
|
domcox@599
|
719 grep -q \$grp /etc/group && addgroup $TGT_USER \$grp
|
domcox@599
|
720 fi
|
domcox@599
|
721 done
|
domcox@599
|
722
|
domcox@665
|
723 echo "$TGT_USER:$TGT_USER_PWD" | chpasswd
|
domcox@599
|
724 if [ ! -d /home/$TGT_USER ]; then
|
domcox@599
|
725 cp -a /etc/skel /home/$TGT_USER
|
domcox@612
|
726 [ -e /root/.xinitrc ] && cp /root/.xinitrc /home/$TGT_USER
|
domcox@599
|
727 mkdir -p /home/$TGT_USER/.config/slitaz
|
domcox@599
|
728 cp -a /etc/slitaz/applications.conf /home/$TGT_USER/.config/slitaz
|
domcox@656
|
729 # Set ownership
|
domcox@654
|
730 if grep -q ^users: /etc/group; then
|
domcox@654
|
731 chown -R $TGT_USER:users /home/$TGT_USER
|
domcox@654
|
732 else
|
domcox@654
|
733 chown -R $TGT_USER:$TGT_USER /home/$TGT_USER
|
domcox@654
|
734 fi
|
domcox@599
|
735 # Path for user desktop files.
|
domcox@599
|
736 for i in /home/$TGT_USER/.local/share/applications/*.desktop
|
domcox@599
|
737 do
|
domcox@599
|
738 [ -e "$i" ] && sed -i s/"user_name"/"$TGT_USER"/g \$i
|
domcox@599
|
739 done
|
domcox@599
|
740 fi
|
domcox@599
|
741 # Slim default user.
|
domcox@599
|
742 if [ -f /etc/slim.conf ]; then
|
domcox@599
|
743 sed -i s/"default_user .*"/"default_user $TGT_USER"/ \
|
domcox@599
|
744 /etc/slim.conf
|
domcox@599
|
745 fi
|
domcox@599
|
746 _EOF_
|
domcox@599
|
747 chmod +x $TARGET_ROOT/users.sh
|
domcox@599
|
748 chroot $TARGET_ROOT ./users.sh
|
domcox@599
|
749 rm $TARGET_ROOT/users.sh
|
domcox@599
|
750 sleep 2
|
domcox@599
|
751 }
|
domcox@599
|
752
|
paul@608
|
753 # /home can be on a separate partition. If default user exists in /home
|
paul@608
|
754 # we remove default file created by users_settings().
|
domcox@599
|
755 home_config()
|
domcox@599
|
756 {
|
domcox@599
|
757 debug "home_config: $TGT_HOME"
|
domcox@665
|
758 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
759 mv home/$TGT_USER tmp
|
domcox@599
|
760 mount $TGT_HOME home
|
domcox@683
|
761 if [ -d $TARGET_ROOT/home/$TGT_USER ]; then
|
domcox@599
|
762 rm -rf tmp/$TGT_USER
|
domcox@599
|
763 else
|
domcox@599
|
764 mv tmp/$TGT_USER home
|
domcox@599
|
765 fi
|
domcox@599
|
766 echo "$TGT_HOME /home ext3 defaults 0 2" \
|
domcox@599
|
767 >> etc/fstab
|
domcox@599
|
768 umount home
|
domcox@599
|
769 }
|
domcox@599
|
770
|
domcox@599
|
771 # Search for a Windows partition
|
domcox@599
|
772 win_partition()
|
domcox@599
|
773 {
|
domcox@665
|
774 debug "Searching for Windows"
|
domcox@599
|
775 if [ "$TGT_WINBOOT" == "auto" ];then
|
domcox@599
|
776 WINBOOT=$(fdisk -l | awk '
|
domcox@599
|
777 BEGIN{disk=-1, found=-1, winboot=""}
|
domcox@599
|
778 {
|
domcox@599
|
779 # Counting disk
|
domcox@599
|
780 if ($1=="Disk"){disk++, part=-1}
|
domcox@599
|
781 # Counting partition
|
domcox@599
|
782 if (substr($1,1,4)=="/dev"){part++}
|
domcox@599
|
783 # Read partition Id
|
domcox@599
|
784 if ($2=="*"){Id=$6} else {Id=$5}
|
domcox@599
|
785 # Detect Windows type
|
domcox@599
|
786 if (Id=="7" || Id=="b"){
|
domcox@599
|
787 if (found){
|
domcox@599
|
788 # record 1st Windows partition found
|
domcox@599
|
789 winboot=sprintf("hd%d,%d",disk,part),found++}
|
domcox@599
|
790 }
|
domcox@599
|
791 }
|
domcox@599
|
792 END{printf "%s", winboot}')
|
domcox@599
|
793 if [ -z "$WINBOOT" ]; then
|
domcox@665
|
794 warning $(gettext "No windows partition found. Dual-boot disabled")
|
domcox@599
|
795 TGT_WINBOOT=""
|
domcox@599
|
796 fi
|
domcox@599
|
797 fi
|
domcox@599
|
798 }
|
domcox@599
|
799
|
domcox@599
|
800 # Determine GRUB partition number and GRUB disk number.
|
domcox@599
|
801 grub_partition()
|
domcox@599
|
802 {
|
domcox@599
|
803 DISK_LETTER=${TGT_PARTITION#/dev/[h-s]d}
|
domcox@599
|
804 DISK_LETTER=${DISK_LETTER%[0-9]}
|
domcox@599
|
805 GRUB_PARTITION=$((${TGT_PARTITION#/dev/[h-s]d[a-z]}-1))
|
domcox@599
|
806 for disk in a b c d e f g h
|
domcox@599
|
807 do
|
domcox@599
|
808 nb=$(($nb+1))
|
domcox@599
|
809 if [ "$disk" = "$DISK_LETTER" ]; then
|
domcox@599
|
810 GRUB_DISK=$(($nb-1))
|
domcox@599
|
811 break
|
domcox@599
|
812 fi
|
domcox@599
|
813 done
|
domcox@599
|
814 GRUB_ROOT="(hd${GRUB_DISK},${GRUB_PARTITION})"
|
domcox@599
|
815 }
|
domcox@599
|
816
|
domcox@599
|
817 # Create grub conf
|
domcox@599
|
818 grub_config()
|
domcox@599
|
819 {
|
domcox@599
|
820 grub_partition
|
domcox@612
|
821 if [ "$TGT_GRUB" == "yes" ]; then
|
domcox@612
|
822 win_partition
|
domcox@612
|
823 fi
|
domcox@599
|
824 # Create the target GRUB configuration.
|
domcox@599
|
825 mkdir -p $TARGET_ROOT/boot/grub
|
domcox@599
|
826 cat > $TARGET_ROOT/boot/grub/menu.lst << _EOF_
|
domcox@599
|
827 # /boot/grub/menu.lst: GRUB boot loader configuration.
|
domcox@599
|
828 #
|
domcox@599
|
829
|
domcox@599
|
830 # By default, boot the first entry.
|
domcox@599
|
831 default 0
|
domcox@599
|
832
|
domcox@599
|
833 # Boot automatically after 8 secs.
|
domcox@599
|
834 timeout 8
|
domcox@599
|
835
|
domcox@599
|
836 # Graphical splash image.
|
domcox@599
|
837 splashimage=/boot/grub/splash.xpm.gz
|
domcox@599
|
838
|
domcox@599
|
839 # Change the colors.
|
domcox@599
|
840 #color yellow/brown light-green/black
|
domcox@599
|
841
|
domcox@599
|
842 # For booting SliTaz from : $TGT_PARTITION
|
domcox@599
|
843 #
|
domcox@599
|
844 title SliTaz GNU/Linux (cooking) (Kernel $KERNEL)
|
domcox@599
|
845 root $GRUB_ROOT
|
pankso@678
|
846 kernel /boot/$KERNEL root=$TGT_PARTITION quiet
|
domcox@599
|
847
|
domcox@599
|
848 _EOF_
|
domcox@599
|
849 if [ -n "$TGT_WINBOOT" ]; then
|
domcox@665
|
850 msg $(gettext "Enabling Windows dual-boot")
|
domcox@612
|
851 cat >> $TARGET_ROOT/boot/grub/menu.lst << _EOF_
|
domcox@599
|
852 # For booting Windows :
|
domcox@599
|
853 #
|
domcox@599
|
854 title Microsoft Windows
|
domcox@599
|
855 rootnoverify ($WINBOOT)
|
domcox@599
|
856 chainloader +1
|
domcox@599
|
857
|
domcox@599
|
858 _EOF_
|
domcox@599
|
859 fi
|
domcox@599
|
860 # log
|
domcox@599
|
861 debug "grub_config: $TARGET_ROOT/boot/grub/menu.lst"
|
domcox@599
|
862 echo "--- menu.lst -------------" >>$LOG
|
domcox@599
|
863 cat $TARGET_ROOT/boot/grub/menu.lst >>$LOG
|
domcox@599
|
864 echo "--- menu.lst -------------" >>$LOG
|
domcox@599
|
865 sleep 2
|
domcox@599
|
866 }
|
domcox@599
|
867
|
domcox@599
|
868 # Files install, calling for functions or with cmds.
|
domcox@599
|
869 install_files()
|
domcox@599
|
870 {
|
domcox@665
|
871 msg "$(gettext "Installing SliTaz on:") $TGT_PARTITION"
|
domcox@599
|
872 # saving pwd
|
domcox@599
|
873 local save_pwd=$(pwd)
|
domcox@599
|
874
|
domcox@599
|
875 debug "Cleaning the root partition if necessary..."
|
domcox@599
|
876 clean_target
|
domcox@599
|
877
|
domcox@599
|
878 debug "Extracting the root system..."
|
domcox@599
|
879 extract_rootfs $SOURCE_ROOT/boot
|
domcox@599
|
880
|
domcox@599
|
881 debug "Installing the kernel..."
|
domcox@599
|
882 install_kernel
|
domcox@599
|
883
|
domcox@599
|
884 debug "Copying the bootloader syslinux/isolinux..."
|
domcox@599
|
885 copy_bootloaders
|
domcox@599
|
886
|
domcox@599
|
887 debug "Preconfiguring the system..."
|
domcox@599
|
888 pre_config_system
|
domcox@599
|
889
|
domcox@665
|
890 msg "$(gettext "Configuring root and default user account:") $TGT_USER"
|
domcox@599
|
891 users_settings
|
domcox@599
|
892
|
domcox@599
|
893 if [ "$TGT_HOME" != "" ]; then
|
domcox@665
|
894 msg "$(gettext "Configuring partition to be used as /home:") $TGT_HOME"
|
domcox@599
|
895 home_config
|
domcox@599
|
896 sleep 2
|
domcox@599
|
897 fi
|
domcox@599
|
898
|
domcox@599
|
899 debug "Creating configuration file for GRUB (menu.lst)..."
|
domcox@599
|
900 grub_config
|
domcox@599
|
901
|
domcox@599
|
902 debug "Files installation completed"
|
domcox@599
|
903 sleep 2
|
domcox@599
|
904 # restoring pwd
|
domcox@599
|
905 cd $save_pwd
|
domcox@599
|
906 }
|
domcox@599
|
907
|
domcox@599
|
908 # GRUB info with disk name used for grub-install.
|
domcox@599
|
909 grub_install()
|
domcox@599
|
910 {
|
domcox@599
|
911 if [ "$TGT_GRUB" == "yes" ]; then
|
domcox@599
|
912 TARGET_DISK=`echo $TGT_PARTITION | sed s/"[0-9]"/''/`
|
domcox@665
|
913 msg "$(gettext "Running grub-install on:") $TARGET_DISK"
|
domcox@599
|
914 grub-install --no-floppy \
|
domcox@599
|
915 --root-directory=$TARGET_ROOT $TARGET_DISK 2>>$LOG
|
domcox@599
|
916 debug "Grub installation done..."
|
domcox@599
|
917 else
|
domcox@599
|
918 debug "Grub not installed"
|
domcox@599
|
919 fi
|
domcox@599
|
920 }
|
domcox@599
|
921
|
domcox@599
|
922 # Copy log file, umount target and eject cdrom.
|
domcox@599
|
923 umount_devices()
|
domcox@599
|
924 {
|
domcox@599
|
925 # Umount target
|
domcox@599
|
926 if mount | grep -q $TARGET_ROOT; then
|
domcox@665
|
927 echo "$(gettext "Unmounting target partition:") $TGT_PARTITION"
|
domcox@599
|
928 umount $TARGET_ROOT 2>>$LOG
|
domcox@599
|
929 fi
|
domcox@599
|
930
|
domcox@599
|
931 # Umount source
|
domcox@599
|
932 if mount | grep -q $SOURCE_ROOT; then
|
domcox@665
|
933 echo "$(gettext "Unmounting:") $SOURCE_ROOT"
|
domcox@599
|
934 umount $SOURCE_ROOT
|
domcox@599
|
935 fi
|
domcox@599
|
936
|
domcox@599
|
937 # Eject cd
|
domcox@599
|
938 if [ "$INST_TYPE" == "cdrom" ]; then
|
domcox@665
|
939 gettext "Ejecting cdrom..."
|
domcox@599
|
940 eject
|
domcox@599
|
941 fi
|
domcox@665
|
942 # Remove lock file
|
domcox@665
|
943 rm -f $LOCK
|
domcox@599
|
944 sleep 2
|
domcox@599
|
945 }
|
domcox@599
|
946
|
domcox@599
|
947 # End of installation.
|
domcox@599
|
948 end_of_install()
|
domcox@599
|
949 {
|
domcox@665
|
950 msg $(gettext "Installation complete. You can now restart (reboot)")
|
domcox@665
|
951 echo " $(gettext "from your SliTaz GNU/Linux system.")"
|
domcox@599
|
952 echo "=== Tazinst end at `date` ===" >>$LOG
|
domcox@612
|
953 # Log files
|
domcox@665
|
954 echo "$(gettext "Copying log files") ($LOG)..."
|
domcox@612
|
955 cp -a $LOG $TARGET_ROOT/var/log
|
domcox@612
|
956 sleep 2
|
domcox@612
|
957 # umount
|
domcox@599
|
958 umount_devices
|
domcox@599
|
959 }
|
domcox@599
|
960
|
domcox@599
|
961 #####################
|
domcox@599
|
962 # Upgrade functions #
|
domcox@599
|
963 #####################
|
domcox@599
|
964
|
domcox@599
|
965 # Mount.
|
domcox@599
|
966 prepare_upgrade()
|
domcox@599
|
967 {
|
domcox@599
|
968 debug "Preparing the target partition..."
|
domcox@612
|
969 # Target may be used
|
domcox@612
|
970 mount | grep -q $TGT_PARTITION && \
|
domcox@665
|
971 abort 5 "$TGT_PARTITION: $(gettext "Partition in use")"
|
domcox@599
|
972 # Mount point can be already used.
|
domcox@599
|
973 if mount | grep -q $TARGET_ROOT; then
|
domcox@599
|
974 umount $TARGET_ROOT 2>>$LOG
|
domcox@599
|
975 fi
|
domcox@599
|
976 mkdir -p $TARGET_ROOT && sleep 2
|
domcox@599
|
977 # Mount target.
|
domcox@599
|
978 mount $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
|
domcox@599
|
979 if [ $(mount | grep -c "mnt/target") == "0" ]; then
|
domcox@665
|
980 abort 5 "$TGT_PARTITION $(gettext "Unable to mount partition")"
|
domcox@599
|
981 fi
|
domcox@599
|
982 }
|
domcox@599
|
983
|
domcox@599
|
984 # Check for a valid SliTaz
|
domcox@599
|
985 check_release()
|
domcox@599
|
986 {
|
domcox@599
|
987 if [ -f $TARGET_ROOT/etc/slitaz-release ]; then
|
domcox@599
|
988 release=`cat $TARGET_ROOT/etc/slitaz-release`
|
domcox@665
|
989 msg "$(gettext "Preparing upgrade of SliTaz release:") $release"
|
domcox@599
|
990 else
|
domcox@665
|
991 abort 6 "$TGT_PARTITION: $(gettext "This partition doesn't appear to contain \
|
domcox@665
|
992 a valid SliTaz system, the file: /etc/slitaz-release doesn't exist.")"
|
domcox@599
|
993 fi && sleep 2
|
domcox@599
|
994 }
|
domcox@599
|
995
|
domcox@599
|
996 # Backup target packages list.
|
domcox@599
|
997 backup_files()
|
domcox@599
|
998 {
|
domcox@665
|
999 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
1000 ls -1 var/lib/tazpkg/installed > home/packages-selection.list
|
domcox@599
|
1001 for dir in *
|
domcox@599
|
1002 do
|
domcox@599
|
1003 case "$dir" in
|
domcox@599
|
1004 boot)
|
domcox@599
|
1005 rm -rf boot/vmlinuz-* ;;
|
domcox@599
|
1006 home)
|
domcox@599
|
1007 mv home home.bak
|
domcox@599
|
1008 debug "keeping /home found on: $TGT_PARTITION" ;;
|
domcox@599
|
1009 etc)
|
domcox@599
|
1010 tar czf etc.tar.gz etc
|
domcox@599
|
1011 mv etc etc.bak
|
domcox@599
|
1012 debug "keeping /etc found on: $TGT_PARTITION" ;;
|
domcox@599
|
1013 var)
|
domcox@599
|
1014 if [ -d var/www ]; then
|
domcox@599
|
1015 mv var/www www.bak
|
domcox@599
|
1016 debug "keeping /var/www found on: $TGT_PARTITION"
|
domcox@599
|
1017 fi
|
domcox@599
|
1018 rm -rf var 2>>$LOG ;;
|
domcox@599
|
1019 lost+found)
|
domcox@599
|
1020 continue ;;
|
domcox@599
|
1021 *)
|
domcox@599
|
1022 debug "removing target: $dir"
|
domcox@599
|
1023 rm -rf $dir 2>>$LOG ;;
|
domcox@599
|
1024 esac
|
domcox@599
|
1025 done
|
domcox@599
|
1026 if [ -d mklost+found ]; then
|
domcox@599
|
1027 mklost+found 2>>$LOG
|
domcox@599
|
1028 fi
|
domcox@599
|
1029 sleep 2
|
domcox@599
|
1030 }
|
domcox@599
|
1031
|
domcox@599
|
1032 # Restore backups.
|
domcox@599
|
1033 restore_files()
|
domcox@599
|
1034 {
|
domcox@599
|
1035 rm -rf $TARGET_ROOT/home
|
domcox@599
|
1036 mv $TARGET_ROOT/home.bak $TARGET_ROOT/home
|
domcox@599
|
1037 rm -rf $TARGET_ROOT/etc
|
domcox@599
|
1038 mv $TARGET_ROOT/etc.bak $TARGET_ROOT/etc
|
domcox@599
|
1039 if [ -d $TARGET_ROOT/www.bak ]; then
|
domcox@599
|
1040 rm -rf $TARGET_ROOT/var/www
|
domcox@599
|
1041 mv $TARGET_ROOT/www.bak $TARGET_ROOT/var/www
|
domcox@599
|
1042 fi
|
domcox@599
|
1043 debug "backups restored: `date`"
|
domcox@599
|
1044
|
domcox@599
|
1045 # /var/lib/slitaz-installer
|
domcox@599
|
1046 mkdir -p $TARGET_ROOT/var/lib/tazinst
|
domcox@599
|
1047 mv $TARGET_ROOT/etc.tar.gz $TARGET_ROOT/var/lib/tazinst
|
domcox@599
|
1048 mv $TARGET_ROOT/home/packages-selection.list $TARGET_ROOT/var/lib/tazinst
|
domcox@599
|
1049 }
|
domcox@599
|
1050
|
domcox@599
|
1051 # Added pkgs
|
domcox@599
|
1052 install_pkgs()
|
domcox@599
|
1053 {
|
domcox@599
|
1054 # Check if the pkg is on the mirror.
|
domcox@599
|
1055 debug "Checking the availability of packages..."
|
domcox@599
|
1056 touch packages-to-install.list
|
domcox@599
|
1057 packages=0
|
domcox@599
|
1058 diff=`cat packages-selection.diff | sort`
|
domcox@599
|
1059 for pkg in $diff
|
domcox@599
|
1060 do
|
domcox@599
|
1061 if grep -q ^$pkg-[0-9] /var/lib/tazpkg/packages.list; then
|
domcox@599
|
1062 packages=$(($packages+1))
|
domcox@599
|
1063 echo "$pkg" >> packages-to-install.list
|
domcox@599
|
1064 fi
|
domcox@599
|
1065 done
|
domcox@599
|
1066
|
domcox@599
|
1067 # Calculate the percent for one package and install.
|
domcox@599
|
1068 debug "Installing any packages..."
|
domcox@599
|
1069 sleep 2
|
domcox@599
|
1070 if [ "$packages" == "0" ]; then
|
domcox@599
|
1071 debug "packages to install: 0"
|
domcox@599
|
1072 else
|
domcox@599
|
1073 onepkg=$((48/$packages))
|
domcox@599
|
1074 pct=50
|
domcox@599
|
1075 # Get-install all missing pkgs.
|
domcox@599
|
1076 for pkg in `cat packages-to-install.list`
|
domcox@599
|
1077 do
|
domcox@599
|
1078 pct=$(($pct+$onepkg))
|
domcox@599
|
1079 echo $pct
|
domcox@599
|
1080 debug "Installing: $pkg..."
|
domcox@599
|
1081 # Get install package and answer yes in case of dependencies.
|
domcox@599
|
1082 pkgname=`grep ^$pkg /var/lib/tazpkg/packages.list`
|
domcox@599
|
1083 tazpkg get $pkg >/dev/null 2>/dev/null
|
domcox@599
|
1084 yes "" | tazpkg install $pkgname.tazpkg --root=$TARGET_ROOT >/dev/null 2>/dev/null
|
domcox@599
|
1085 rm -f $pkgname.tazpkg
|
domcox@599
|
1086 done
|
domcox@599
|
1087 fi
|
domcox@599
|
1088 echo 100
|
domcox@599
|
1089 debug "Installation of packages complete..."
|
domcox@599
|
1090 sleep 2
|
domcox@599
|
1091 }
|
domcox@599
|
1092
|
domcox@599
|
1093 # Search for added pkgs
|
domcox@599
|
1094 update_pkgs()
|
domcox@599
|
1095 {
|
domcox@665
|
1096 cd $TARGET_ROOT/var/lib/tazinst || abort 8 $(gettext "Internal")
|
domcox@599
|
1097 # LiveCD packages list.
|
domcox@599
|
1098 debug "Creating package lists..."
|
domcox@599
|
1099 ls -1 $TARGET_ROOT/var/lib/tazpkg/installed > packages-source.list || exit 1
|
domcox@599
|
1100 debug "packages-source.list: done"
|
domcox@599
|
1101 # Diff
|
domcox@599
|
1102 diff packages-source.list packages-selection.list | \
|
domcox@599
|
1103 grep ^+[a-z] | sed s/^+// > packages-selection.diff
|
domcox@599
|
1104 debug "packages-selection.diff: done"
|
domcox@599
|
1105 # Get mirror list.
|
domcox@599
|
1106 tazpkg recharge >>$LOG 2>>$LOG
|
domcox@599
|
1107 if [ -f /var/lib/tazpkg/packages.list ]; then
|
domcox@599
|
1108 install_pkgs
|
domcox@599
|
1109 else
|
domcox@599
|
1110 touch packages-to-install.list
|
domcox@665
|
1111 warning $(gettext "The list of available packages on the mirror could not be \
|
domcox@599
|
1112 downloaded. No missing packages will be reinstalled now, but \
|
domcox@599
|
1113 you can do so later by looking at the following list: \
|
domcox@665
|
1114 /var/lib/tazinst/packages-selection.diff")
|
domcox@599
|
1115 fi
|
domcox@599
|
1116 sleep 2
|
domcox@599
|
1117 }
|
domcox@599
|
1118
|
domcox@599
|
1119 # Update grub conf
|
domcox@599
|
1120 grub_update()
|
domcox@599
|
1121 {
|
domcox@599
|
1122 # Backup and create a new grub menu.lst.
|
domcox@599
|
1123 if [ "$TGT_GRUB" == "yes" ]; then
|
domcox@665
|
1124 msg $(gettext "Grub update")
|
domcox@599
|
1125 mv $TARGET_ROOT/boot/grub/menu.lst \
|
domcox@599
|
1126 $TARGET_ROOT/boot/grub/menu.lst.bak 2>/dev/null
|
domcox@599
|
1127 grub_config
|
domcox@599
|
1128 fi
|
domcox@599
|
1129 }
|
domcox@599
|
1130
|
domcox@599
|
1131 # Prepare the partition to upgrade, backup, install, restore configs
|
domcox@599
|
1132 # and reinstall pkgs.
|
domcox@599
|
1133 upgrade_files()
|
domcox@599
|
1134 {
|
domcox@599
|
1135 # saving pwd
|
domcox@599
|
1136 local save_pwd=$(pwd)
|
domcox@665
|
1137 cd $TARGET_ROOT || abort 8 $(gettext "Internal")
|
domcox@599
|
1138
|
domcox@599
|
1139 debug "Searching for /etc/slitaz-release"
|
domcox@599
|
1140 check_release
|
domcox@599
|
1141
|
domcox@665
|
1142 msg $(gettext "Backup /etc, /home and the packages list...")
|
domcox@599
|
1143 backup_files
|
domcox@599
|
1144
|
domcox@665
|
1145 msg "$(gettext "Upgrading SliTaz on:") $TGT_PARTITION"
|
domcox@599
|
1146
|
domcox@599
|
1147 debug "Copying the bootloader syslinux/isolinux..."
|
domcox@599
|
1148 copy_bootloaders
|
domcox@599
|
1149
|
domcox@599
|
1150 debug "Extracting the root system..."
|
domcox@599
|
1151 extract_rootfs $SOURCE_ROOT/boot
|
domcox@599
|
1152
|
domcox@665
|
1153 msg $(gettext "Restoring configuration files...")
|
domcox@599
|
1154 restore_files
|
domcox@599
|
1155
|
domcox@599
|
1156 debug "Installing the kernel..."
|
domcox@599
|
1157 install_kernel
|
domcox@599
|
1158
|
domcox@665
|
1159 msg $(gettext "Upgrading added packages...")
|
domcox@599
|
1160 update_pkgs
|
domcox@599
|
1161
|
domcox@599
|
1162 # restoring pwd
|
domcox@599
|
1163 cd $save_pwd
|
domcox@599
|
1164 }
|
domcox@599
|
1165
|
domcox@599
|
1166 # End of system upgrade.
|
domcox@599
|
1167 end_of_upgrade()
|
domcox@599
|
1168 {
|
domcox@599
|
1169 pkgscd=`cat $TARGET_ROOT/var/lib/tazinst/packages-source.list | wc -l`
|
domcox@599
|
1170 pkginst=`cat $TARGET_ROOT/var/lib/tazinst/packages-to-install.list | wc -l`
|
domcox@665
|
1171 msg $(gettext "Upgrade finished. You can now restart (reboot)")
|
domcox@665
|
1172 echo $(gettext "from your SliTaz GNU/Linux system.")
|
domcox@665
|
1173 echo "$(gettext "Packages on the cdrom :") $pkgscd"
|
domcox@665
|
1174 echo "$(gettext "Packages installed from the mirror :") $pkginst"
|
domcox@599
|
1175 echo "=== Tazinst end at `date` ===" >>$LOG
|
domcox@599
|
1176 umount_devices
|
domcox@599
|
1177 }
|
domcox@599
|
1178
|
domcox@599
|
1179 ######################
|
domcox@599
|
1180 # Installer sequence #
|
domcox@599
|
1181 ######################
|
domcox@599
|
1182
|
domcox@599
|
1183 case $1 in
|
domcox@599
|
1184 install)
|
domcox@599
|
1185 INST_ACTION=install
|
domcox@599
|
1186 check_root
|
domcox@599
|
1187 init $@
|
domcox@665
|
1188 read_setup_file $2
|
domcox@599
|
1189 check_vars
|
domcox@599
|
1190 check_source
|
domcox@599
|
1191 prepare_install
|
domcox@599
|
1192 install_files
|
domcox@599
|
1193 grub_install
|
domcox@599
|
1194 end_of_install ;;
|
domcox@599
|
1195 upgrade)
|
domcox@599
|
1196 INST_ACTION=upgrade
|
domcox@599
|
1197 check_root
|
domcox@599
|
1198 init $@
|
domcox@665
|
1199 read_setup_file $2
|
domcox@599
|
1200 check_vars
|
domcox@599
|
1201 check_source
|
domcox@599
|
1202 prepare_upgrade
|
domcox@599
|
1203 upgrade_files
|
domcox@599
|
1204 grub_update
|
domcox@599
|
1205 end_of_upgrade ;;
|
domcox@665
|
1206 new)
|
domcox@665
|
1207 gen_setup $2 ;;
|
domcox@656
|
1208 showurl)
|
domcox@656
|
1209 case $2 in
|
domcox@656
|
1210 stable)
|
domcox@656
|
1211 echo $URL_STABLE ;;
|
domcox@656
|
1212 cooking)
|
domcox@656
|
1213 echo $URL_COOKING ;;
|
domcox@656
|
1214 rolling)
|
domcox@656
|
1215 echo $URL_ROLLING ;;
|
domcox@656
|
1216 esac ;;
|
domcox@656
|
1217 check)
|
domcox@656
|
1218 LOG="/dev/null"
|
domcox@656
|
1219 INST_ACTION=check
|
domcox@656
|
1220 check_root
|
domcox@656
|
1221 init $@
|
domcox@665
|
1222 read_setup_file $2
|
domcox@665
|
1223 check_vars
|
domcox@665
|
1224 rm -f $LOCK ;;
|
domcox@661
|
1225 log)
|
domcox@665
|
1226 [ -r "$LOG" ] && cat $LOG ;;
|
domcox@657
|
1227 version)
|
domcox@657
|
1228 echo $VERSION ;;
|
domcox@599
|
1229 usage|*)
|
domcox@599
|
1230 usage ;;
|
domcox@599
|
1231 esac
|
domcox@599
|
1232
|
domcox@599
|
1233 exit 0
|