-
Notifications
You must be signed in to change notification settings - Fork 37
/
tc-config
executable file
·644 lines (582 loc) · 17.7 KB
/
tc-config
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
#!/bin/busybox ash
# RC Script for Tiny Core Linux
# (c) Robert Shingledecker 2004-2012
# Several modifications for speed by Curaga
. /etc/init.d/tc-functions
useBusybox
USER="tc"
TCEDIR="/tmp/tce"
TCEOPT="/tmp/tce/optional"
TCLOOP="/tmp/tcloop"
TCEINSTALLED="/usr/local/tce.installed"
INSTALLED=""
VERSION="$(cat /usr/share/doc/tc/release.txt)"
KERNEL="$(uname -r)"
addUser(){
echo "${GREEN}Adding user ${YELLOW}$USER ${NORMAL}"
/usr/sbin/adduser -s /bin/sh -G staff -D "$USER"
echo "$USER":tcuser | /usr/sbin/chpasswd -m
echo -e "$USER\tALL=NOPASSWD: ALL" >> /etc/sudoers
}
### END functions
# Main
echo "${GREEN}Booting ${YELLOW}Core $VERSION ${NORMAL}"
echo "${GREEN}Running Linux Kernel ${YELLOW}$KERNEL${GREEN}.${NORMAL}"
export PATH=/usr/local/sbin:/usr/local/bin:"$PATH"
# Here we check all the boot parameters using the fastest way known to men, case & loop
echo -n "${BLUE}Checking boot options...${NORMAL}"
for i in `cat /proc/cmdline`; do
case $i in
*=*)
case $i in
waitusb*) WAITUSB=${i#*=} ;;
lang*) LANGUAGE=${i#*=} ;;
kmap*) KEYMAP=${i#*=} ;;
tz*) TZ=${i#*=} ;;
desktop*) DESKTOP=${i#*=} ;;
ntpserver*) NTPSERVER=${i#*=} ;;
icons*) ICONS=${i#*=} ;;
noicons*) NOICONS=${i#*=} ;;
user*) USER=${i#*=} ;;
home*) MYHOME=${i#*=} ;;
tcvd*) TCVD=${i#*=} ;;
opt*) MYOPT=${i#*=} ;;
swapfile*) SWAPFILE=${i#*=} ;;
resume*) RESUME=${i#*=} ;;
host*) HOST=1 ;;
nfsmount* ) NFSMOUNT=${i#*=} ;;
tftplist* ) TFTPLIST=${i#*=} ;;
httplist* ) HTTPLIST=${i#*=} ;;
aoe* ) AOE=${i#*=} ;;
nbd* ) NBD=${i#*=} ;;
mydata* ) MYDATA=${i#*=} ;;
pretce* ) PRETCE=${i#*=} ;;
xvesa* ) XVESA=${i#*=} ;;
rsyslog=* ) RSYSLOG=${i#*=}; SYSLOG=1 ;;
blacklist* ) BLACKLIST="$BLACKLIST ${i#*=}" ;;
iso* ) ISOFILE=${i#*=} ;;
esac
;;
*)
case $i in
nozswap) NOZSWAP=1 ;;
nofstab) NOFSTAB=1 ;;
nortc) NORTC=1 ;;
syslog) SYSLOG=1 ;;
noutc) NOUTC=1 ;;
nodhcp) NODHCP=1 ;;
noicons) NOICONS=1 ;;
text) TEXT=1 ;;
xonly) XONLY=1 ;;
superuser) SUPERUSER=1 ;;
noswap) NOSWAP=1 ;;
secure) SECURE=1 ;;
protect) PROTECT=1 ;;
cron) CRON=1 ;;
xsetup) XSETUP=1 ;;
laptop) LAPTOP=1 ;;
base) ONLYBASE=1 ;;
showapps) SHOWAPPS=1 ;;
norestore) NORESTORE=1 ;;
noautologin) NOAUTOLOGIN=1 ;;
pause) PAUSE=1 ;;
esac
;;
esac
done
echo "${GREEN} Done.${NORMAL}"
if [ -n "$BLACKLIST" ]; then
mkdir -p /etc/modprobe.d
for i in $BLACKLIST; do
echo "$i" | tr ',' '\n' | while read j ; do
echo "blacklist $j" >> /etc/modprobe.d/blacklist.conf
done
done
fi
# Start Udev to populate /dev and handle hotplug events
echo -n "${BLUE}Starting udev daemon for hotplug support...${NORMAL}"
#/sbin/udevd --daemon 2>/dev/null >/dev/null
/sbin/udevd --daemon 2>&1 >/dev/null
#/sbin/udevadm trigger --action=add 2>/dev/null >/dev/null &
/sbin/udevadm trigger --action=add 2>&1 >/dev/null &
rotdash $!
echo "${GREEN} Done.${NORMAL}"
[ -n "$WAITUSB" ] && (
case $WAITUSB in
*:*) dev=${WAITUSB#*:}
timeout=$((${WAITUSB%:*} * 4))
while [ $timeout -gt 0 ]; do
echo -en "${BLUE}\rWaiting as requested... ${NORMAL}$(($timeout / 4)) "
timeout=$(($timeout - 1))
blkid -lt $dev >/dev/null && timeout=0 || sleep 0.25
done
echo
;;
*) sleep "$WAITUSB" ;;
esac
)
modprobe loop 2>/dev/null
#modprobe ohci_hcd
if [ -n "$NOZSWAP" ]; then
echo "${BLUE}Skipping compressed swap in ram as requested from the boot command line.${NORMAL}"
else
modprobe -q zram
modprobe -q zcache
while [ ! -e /dev/zram0 ]; do usleep 50000; done
grep MemFree /proc/meminfo | awk '{print $2/4 "K"}' > /sys/block/zram0/disksize
mkswap /dev/zram0 >/dev/null 2>&1
swapon /dev/zram0
echo "/dev/zram0 swap swap defaults,noauto 0 0" >> /etc/fstab # Lets swapoff -a work
fi
if [ -n "$NOFSTAB" ]; then
echo "${BLUE}Skipping /etc/fstab creation as requested from the boot command line.${NORMAL}"
else
echo "${BLUE}Scanning hard disk partitions to create ${YELLOW}/etc/fstab ${NORMAL}"
/usr/sbin/rebuildfstab & fstab_pid=$!
mv /tmp/98-tc.rules /etc/udev/rules.d/. 2>/dev/null
/sbin/udevadm control --reload-rules &
fi
[ -n "$LANGUAGE" ] || LANGUAGE="C"
echo -n "${GREEN}Setting Language to ${MAGENTA}$LANGUAGE"
echo "LANG=$LANGUAGE" > /etc/sysconfig/language
export LANG=$LANGUAGE
echo "${GREEN} Done.${NORMAL}"
if [ -n "$TZ" ]; then
echo -n "${GREEN}Setting Timezone to ${MAGENTA}$TZ"
export TZ && echo "TZ=$TZ" > /etc/sysconfig/timezone
echo "${GREEN} Done.${NORMAL}"
fi
if [ -n "$NORTC" ]; then
echo "${BLUE}Skipping rtc as requested from the boot command line.${NORMAL}"
else
while [ ! -e /dev/rtc0 ]; do usleep 50000; done
if [ -n "$NOUTC" ]; then
/sbin/hwclock -l -s &
else
/sbin/hwclock -u -s &
fi
fi
if [ -n "$HOST" ]; then
sethostname
else
/bin/hostname -F /etc/hostname
fi
if [ -n "$SYSLOG" ]; then
[ -z "$RSYSLOG" ] || SOPTS=" -R $RSYSLOG -L "
/sbin/syslogd ${SOPTS} && echo "${GREEN}syslog started.${NORMAL}"
/sbin/klogd && echo "${GREEN}klog started."
fi
/sbin/ifconfig lo 127.0.0.1 up
/sbin/route add 127.0.0.1 lo &
if [ -n "$AOE" ]; then
IFACE=$( echo $AOE | awk -F: '{ print $1 }')
DEV=$( echo $AOE | awk -F: '{ print $2 }')
ifconfig $IFACE up
modprobe aoe
echo "${BLUE}Waiting for $DEV${NORMAL}"
CNT=120
until [ -e /dev/etherd/interfaces ]
do
[ $((--CNT)) -le 0 ] && break
echo -ne "${RED}$CNT \r"
sleep 1
done
printf "%s\0" $IFACE > /dev/etherd/interfaces
echo > /dev/etherd/discover
until [ -e /dev/etherd/$DEV ]
do
[ $((--CNT)) -le 0 ] && break
echo -ne "${RED}$CNT \r"
sleep 1
done
if [ $CNT -gt 0 ] ; then
ln -s /dev/etherd/$DEV /dev/$DEV
mkdir -p /mnt/$DEV
mount /dev/$DEV /mnt/$DEV >/dev/null 2>&1
else
echo -ne "\n$DEV NOT mounted! Press <ENTER>" ; read junk
fi
echo "${NORMAL}"
fi
# dhcp.sh runs udhcpc async, so it exits before network is up
wait4Server() {
if [ -n "$NODHCP" -a "$(type -t static_ip)" == "static_ip" ]; then
static_ip
else
/etc/init.d/dhcp.sh
fi
SERVER=$1 ; NOPING=$2 ; CNT=0
if [ "$NOPING" == "1" ] ; then
until ifconfig | grep -q Bcast
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
else
until ping -c 1 $SERVER >/dev/null 2>&1
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
fi
DHCP_RAN=1
}
if [ -n "$USER" ]; then
if ! grep "$USER" /etc/passwd >/dev/null; then addUser; fi
else
USER="tc"
fi
echo "$USER" > /etc/sysconfig/tcuser
mkdir -p /home/"$USER"
if [ -n "$SUPERUSER" ]; then
touch /etc/sysconfig/superuser
fi
# Setup base directories for TCE Applicatons
[ -d "$TCEINSTALLED" ] || mkdir "$TCEINSTALLED"
[ -d "$TCEDIR" ] || mkdir "$TCEDIR"
[ -d "$TCEOPT" ] || mkdir "$TCEOPT"
[ -d "$TCLOOP" ] || mkdir "$TCLOOP"
ln -sf "$TCEDIR" /etc/sysconfig/tcedir
chown "$USER" "$TCEOPT"
chgrp staff "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"
chmod g+w "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP"
chmod u+s /bin/busybox.suid /usr/bin/sudo
get_app() {
LOADER="tce-load -i" ; PKG=optional
PROTO=$1
HOST=${2%%/*}
REST=${2#*/}
LENG=$((${#HOST}-1)) ; LAST=${HOST:$LENG:1}
[ "$LAST" == ":" ] && HOST=${HOST:0:$LENG}
FILE=${REST%:*}
NAME=${FILE##*/}
OPTS=${REST#*:}
[ "$OPTS" == "no-ping" ] && NOPING=1 || NOPING=0
[ -z "$DHCP_RAN" ] && wait4Server $HOST $NOPING
( TCE=/tmp/tce/$PKG
cd $TCE
[ "$PROTO" = "TFTP" ] && tftp -g -r $FILE $HOST
[ "$PROTO" = "HTTP" ] && wget -q http://${HOST}/${FILE}
[ $SHOWAPPS ] && echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
dos2unix -u $NAME
while read FILE FL
do
APP=${FILE##*/}
[ "$PROTO" = "TFTP" ] && tftp -g -r $FILE $HOST
[ "$PROTO" = "HTTP" ] && wget -q http://${HOST}/${FILE}
[ $SHOWAPPS ] && echo -ne "$APP "
su "$USER" -c "$LOADER $FL $TCE/$APP"
[ "$FL" == "-c" ] && rm $APP
done < $NAME
[ $SHOWAPPS ] && echo "${GREEN} Done.${NORMAL}"
rm $NAME
)
}
# Preload drivers needed for tce/opt/home on lvm/RAID etc
if [ -n "$PRETCE" ]; then
PKG=optional ; LOADER="tce-load -i" ; LIST=onboot.lst
RAM=/tmp/tce
CPTOFS=""
if [ "$PRETCE" == "RAM" ] ; then
SRC=$RAM
[ -f $SRC/copy2fs.flg ] && CPTOFS=1
else
PPATH=${PRETCE%%/*}
mkdir -p /mnt/$PPATH
mount /dev/$PPATH /mnt/$PPATH
SRC=/mnt/$PRETCE
[ -x $SRC/onpre.sh ] && cp $SRC/onpre.sh /tmp
[ -f $SRC/copy2fs.flg ] && CPTOFS=1
if [ $CPTOFS ] ; then
cp $SRC/$PKG/* $RAM/$PKG/
cp $SRC/$LIST $RAM/
SRC=$RAM
umount /mnt/$PPATH 2>/dev/null
fi
fi
MNT=""
while read NAME OPT
do
[ $CPTOFS ] || grep -q $NAME $SRC/copy2fs.lst 2>/dev/null && FL="-c" || FL=''
[ $FL ] || MNT=1
su "$USER" -c "/usr/bin/$LOADER $SRC/$PKG/$NAME"
[ "$SRC" == "$RAM" ] && [ "$FL" == "-c" ] && rm $RAM/$PKG/$NAME
done < $SRC/$LIST
[ "$SRC" != "$RAM" ] && [ $MNT ] || umount /mnt/$PPATH 2>/dev/null
rm $RAM/copy2fs.flg $RAM/copy2fs.lst 2>/dev/null
[ -x /tmp/onpre.sh ] && /tmp/onpre.sh
fi
# First process tftp and http entries
modprobe -q squashfs 2>/dev/null
[ -n "$TFTPLIST" ] && get_app "TFTP" $TFTPLIST
[ -n "$HTTPLIST" ] && get_app "HTTP" $HTTPLIST
if [ -n "$NFSMOUNT" ]; then
NFSPTH="/mnt/nfs"
SERVER=$( echo $NFSMOUNT | awk -F: '{ print $1 }')
DIR=$( echo $NFSMOUNT | awk -F: '{ print $2 }')
OPTS=$( echo $NFSMOUNT | awk -F: '{ print $3 }' | tr "," " " )
MOUNT=mount; MOUNT4=/usr/local/sbin/mount.nfs4; NOPING=0
echo "${RED}Mounting NFS Server ${YELLOW}${SERVER}:${DIR}${NORMAL}"
set $OPTS END
while [ "$1" != "END" ]
do
case $1 in
no-ping) NOPING=1 ;;
nfs4) [ -x $MOUNT4 ] && MOUNT=$MOUNT4 ;;
*) MYOPTS="${MYOPTS} $1" ;;
esac
shift
done
MYOPTS=$(echo $MYOPTS) # Remove pre/trailing space(s)
MYOPTS=${MYOPTS// /,} # Replace SPACE with COMMA
[ -z "$DHCP_RAN" ] && wait4Server $SERVER $NOPING
wait $fstab_pid
if [ -d $NFSPTH ]; then umount $NFSPTH >/dev/null 2>&1; fi
mkdir -p $NFSPTH
if [ -x /usr/local/etc/init.d/nfs-client ]; then
echo " --> nfs-utils detected"
/usr/local/etc/init.d/nfs-client start
OP=""; if [ ! "${MYOPTS}" == "" ]; then OP="-o $MYOPTS"; fi
if $MOUNT "${SERVER}:${DIR}" $OP $NFSPTH 2>/dev/null; then
FSOP=""; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi
echo "${SERVER}:${DIR} $NFSPTH nfs defaults${FSOP} 0 0" >>/etc/fstab
elif mount "${SERVER}:${DIR}" $OP $NFSPTH 2>/dev/null; then
FSOP=""; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi
echo "${SERVER}:${DIR} $NFSPTH nfs defaults${FSOP} 0 0" >>/etc/fstab
fi
elif
OP="-o nolock"; if [ ! "${MYOPTS}" == "" ]; then OP="-o $MYOPTS"; fi
echo " --> mounting bb-mount with $OP"
mount $OP "${SERVER}:${DIR}" $NFSPTH 2>/dev/null; then
FSOP="nolock"; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi
echo "${SERVER}:${DIR} $NFSPTH nfs defaults,${FSOP} 0 0" >>/etc/fstab
else
echo "${RED}Mounting ${SERVER}:${DIR} failed${NORMAL}"
fi
fi
touch /var/tmp/k5_skip
if [ -n "$NBD" ]; then
modprobe -q nbd
SERVER=$( echo $NBD | awk -F: '{ print $1 }')
PORT=$( echo $NBD | awk -F: '{ print $2 }')
OPTS=$( echo $NBD | awk -F: '{ print $3 }')
[ "$OPTS" == "no-ping" ] && NOPING=1 || NOPING=0
[ -z "$DHCP_RAN" ] && wait4Server $SERVER $NOPING
nbd-client $SERVER $PORT /dev/nbd0
mkdir /mnt/nbd0
mount /dev/nbd0 /mnt/nbd0 2>&1
pidof nbd-client nbd0 >> /var/tmp/k5_skip
fi
if grep -q "^/dev/root" /proc/mounts; then
INSTALLED=1
echo "${RED}Detected Traditional Hard drive installation.${NORMAL}"
fi
/sbin/ldconfig 2>/dev/null
[ -n "$TEXT" ] && touch /etc/sysconfig/text
[ -n "$XONLY" ] && touch /etc/sysconfig/xonly
#Check for Virtual Hard Drive
if [ -n "$TCVD" ]; then
wait $fstab_pid
TCVD="${TCVD#/}"
TCVD="${TCVD#dev/}"
TCVD_DEVICE="${TCVD%%/*}"
TCVD_LOOPFILE="${TCVD#*/}"
if [ "$TCVD_DEVICE" == "$TCVD_LOOPFILE" ]; then
TCVD_DEVICE="$(autoscan $TCVD_LOOPFILE 'f')"
fi
PARTITION="${TCVD_DEVICE##/dev/}"
find_mountpoint "$PARTITION"
if [ -n "$MOUNTPOINT" ]; then
[ "$MOUNTED" == "yes" ] || /bin/mount "$MOUNTPOINT"
usleep_progress
if [ -f "$MOUNTPOINT"/"$TCVD_LOOPFILE" ]; then
[ -d /mnt/tcvd ] || /bin/mkdir /mnt/tcvd
ln -sf "$MOUNTPOINT"/"$TCVD_LOOPFILE" /dev/tcvd
printf "/dev/tcvd \t/mnt/tcvd \text2\tloop\t0 0 #Added by TC\n" >> /etc/fstab
sync
fi
fi
fi
if [ -n "$MYHOME" ]; then
wait $fstab_pid
PARTITION=${MYHOME##/dev/}
find_mountpoint "$PARTITION"
if [ -n "$MOUNTPOINT" ]; then
[ "$MOUNTED" == "yes" ] || mount "$MOUNTPOINT"
MS_MNTS=`mount|awk '$5~/fat|vfat|msdos|ntfs/{printf "%s ",$3}'`
case "$MS_MNTS" in
*"$MOUNTPOINT"* )
echo "Persistent HOME not supported on Microsoft File Systems."
echo "${YELLOW}Request for persistent HOME on $PARTITION ignored."
echo -n "${RED}Press Enter key.${NORMAL}"; read ans
;;
* )
if [ -d "$MOUNTPOINT/home/$USER" ]; then
mount --bind "$MOUNTPOINT/home" /home
else
mkdir -p "$MOUNTPOINT/home/$USER"
mount --bind "$MOUNTPOINT/home" /home
fi
;;
esac
else
echo "Invalid device specified. Ignoring persistent HOME request!"
fi
fi
setupHome
unset OPT_SETUP
if [ -n "$MYOPT" ]; then
wait $fstab_pid
PARTITION=${MYOPT##/dev/}
find_mountpoint "$PARTITION"
if [ -n "$MOUNTPOINT" ]; then
[ "$MOUNTED" == "yes" ] || mount "$MOUNTPOINT"
MS_MNTS=`mount|awk '$5~/fat|vfat|msdos|ntfs/{printf "%s ",$3}'`
case "$MS_MNTS" in
*"$MOUNTPOINT"* )
echo "Persistent OPT not supported on Microsoft File Systems."
echo "${YELLOW}Request for persistent OPT on $PARTITION ignored."
echo -n "${RED}Press Enter key.${NORMAL}"; read ans
;;
* )
[ -d "$MOUNTPOINT"/opt ] || mkdir "$MOUNTPOINT"/opt
yes n | cp -ai /opt/. "$MOUNTPOINT"/opt/ 2>/dev/null
mount --bind "$MOUNTPOINT"/opt/ /opt/
chgrp -R staff /opt/ >/dev/null 2>&1
chmod -R g+w /opt/ >/dev/null 2>&1
chmod g+s /opt/ >/dev/null 2>&1
;;
esac
else
echo "Invalid device specified. Skipping persistent OPT request!"
fi
fi
[ -n "$XSETUP" ] && touch /tmp/xsetup_requested
if [ -n "$LAPTOP" ]; then
modprobe ac && modprobe battery 2>/dev/null
modprobe yenta_socket >/dev/null 2>&1 || modprobe i82365 >/dev/null 2>&1
/sbin/udevadm trigger 2>/dev/null >/dev/null &
echo "${GREEN}Laptop options enabled (AC, Battery and PCMCIA).${NORMAL}"
fi
if [ -n "$NOSWAP" ]; then
echo "${BLUE}Ignoring swap partition(s) seek as requested.${NORMAL}"
else
wait $fstab_pid
/sbin/swapon -a 2>/dev/null
if [ "$?" == 0 ]; then echo "${GREEN}Possible swap partition(s) enabled.${NORMAL}"; fi
fi
if [ -n "$SWAPFILE" ]; then
wait $fstab_pid
SWAPFILE=${SWAPFILE##/dev/}
find_mountpoint "$SWAPFILE"
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "yes" ]; then
swapon "$MOUNTPOINT"/tc.swp
else
mount "$MOUNTPOINT" && swapon "$MOUNTPOINT"/tc.swp
fi
fi
fi
if [ -n "$RESUME" ]; then
rm -f /etc/sysconfig/tc.resume 2>/dev/null
RESUME=`basename $RESUME`
SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
[ -z "$SWAP_SIZE" ] && /sbin/swapon /dev/"$RESUME" && SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
[ -z "$SWAP_SIZE" ] && exit 1
MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}')
if [ $SWAP_SIZE -gt $MEM_SIZE ]; then
grep -q disk /sys/power/state && echo "disk" > /etc/sysconfig/tc.resume
fi
fi
if [ "$NOICONS" == 1 ]; then
> /etc/sysconfig/icons
else
# If icon manager is specified use that
if [ -n "$ICONS" ]; then
echo "$ICONS" > /etc/sysconfig/icons
else
[ -s /etc/sysconfig/icons ] && ICONS=`cat /etc/sysconfig/icons`
fi
fi
[ "$NOICONS" == "ondemand" ] && touch /etc/sysconfig/noondemandicons
sync
wait $fstab_pid
MSSG="${BLUE}Loading extensions...${NORMAL}"
if [ -n "$SHOWAPPS" ]; then
touch /etc/sysconfig/showapps
echo "$MSSG"
/usr/bin/tce-setup "booting"
[ -n "$ISOFILE" ] && /usr/bin/fromISOfile "$ISOFILE"
rm /etc/sysconfig/showapps
echo "${GREEN} Done.${NORMAL}"
else
echo -n "$MSSG"
/usr/bin/tce-setup "booting" > /dev/null 2>&1 &
rotdash $!
[ -n "$ISOFILE" ] && /usr/bin/fromISOfile "$ISOFILE" > /dev/null 2>&1 &
rotdash $!
echo "${GREEN} Done.${NORMAL}"
if [ -s /tmp/aberr ]; then
echo "${RED}Warning! Errors occured during the loading of the extensions.${YELLOW}"
cat /tmp/aberr
echo -n "${RED}Press Enter key.${NORMAL}"; read ans
fi
fi
[ -n "$KEYMAP" ] || KEYMAP="us"
if [ -f "/usr/share/kmap/$KEYMAP.kmap" ]; then
echo -n "${GREEN}Setting keymap to ${MAGENTA}$KEYMAP"
/sbin/loadkmap < /usr/share/kmap/$KEYMAP.kmap
echo "KEYMAP=$KEYMAP" > /etc/sysconfig/keymap
echo "${GREEN} Done.${NORMAL}"
fi
if [ -n "$SECURE" ]; then
getpasswd "root"
echo "root:$PASSWD" | chpasswd -m
getpasswd "$USER"
echo "$USER:$PASSWD" | chpasswd -m
fi
if [ -n "$PROTECT" ]; then
getpasswd "encryption"
echo "$PASSWD" > /etc/sysconfig/bfe
chown ${USER}:root /etc/sysconfig/bfe
chmod 600 /etc/sysconfig/bfe
fi
[ -n "$XVESA" ] && sed -i 's/1024x768x32/'"$XVESA"'/' /home/"$USER"/.xsession 2>/dev/null
# If desktop is specified use that
if [ -n "$DESKTOP" ]; then
echo "$DESKTOP" > /etc/sysconfig/desktop
else
[ -s /etc/sysconfig/desktop ] && DESKTOP=`cat /etc/sysconfig/desktop`
fi
# If ntpserver is specified use that
if [ -n "$NTPSERVER" ]; then
echo "$NTPSERVER" > /etc/sysconfig/ntpserver
else
[ -s /etc/sysconfig/ntpserver ] && NTPSERVER=`cat /etc/sysconfig/ntpserver`
fi
# If restore then also pass TCE directory for quick look of mydata.tgz backupfile
if [ -n "$MYDATA" ]; then
echo "$MYDATA" > /etc/sysconfig/mydata
else
echo "mydata" > /etc/sysconfig/mydata
fi
if [ -n "$NORESTORE" ]; then
echo "${GREEN}Skipping restore as requested from the command line.${NORMAL}"
else
TCEDIR=`readlink /etc/sysconfig/tcedir`
/etc/init.d/tc-restore.sh "$TCEDIR"
fi
# After restore items
if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
[ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh &
[ -z "$NORTC" ] || /etc/init.d/settime.sh &
fi
[ -n "$CRON" ] && /etc/init.d/services/crond start
/sbin/loadcpufreq 2>/dev/null &
/opt/bootsync.sh
[ -n "$NOAUTOLOGIN" ] && echo "booting" > /etc/sysconfig/noautologin
if [ -n "$PAUSE" ]; then
echo -n "${BLUE}Boot time configuration completed. Press <Enter> to continue.${NORMAL}"
read junk
fi