Welcome to the Tiny Core Linux Wiki at tinycorelinux.net!

This is an old revision of the document!


Boot-scripts (source, 20150429)

'init' (on initrd)

 1  #!/bb/ash
 2  /bb/mount proc
 3  /bb/grep -qw multivt /proc/cmdline && /bb/sed -i s/^#tty/tty/ /etc/inittab
 4  if ! /bb/grep -qw noembed /proc/cmdline; then
 5    /bb/mount / -o remount,size=90%
 6    /bb/umount proc
 7    exec /bb/init
 8  fi
 9  /bb/umount proc
10  if /bb/mount -t tmpfs -o size=90% tmpfs /mnt; then
11    if /bb/tar -C / --exclude=mnt -cf - . | /bb/tar -C /mnt/ -xf - ; then
12      /bb/mkdir /mnt/mnt
13      exec /bb/switch_root mnt /bb/init
14    fi
15  fi
16  exec /bb/init

'/etc/inittab'

 1  # /etc/inittab: init configuration for busybox init.
 2  # Boot-time system configuration/initialization script.
 3  #
 4  ::sysinit:/etc/init.d/rcS
 5  
 6  # /bb/getty respawn shell invocations for selected ttys.
 7  tty1::respawn:/bb/getty -nl /sbin/autologin 38400 tty1
 8  #tty2::respawn:/bb/getty 38400 tty2
 9  #tty3::respawn:/bb/getty 38400 tty3
10  #tty4::askfirst:/bb/getty 38400 tty4
11  #tty5::askfirst:/bb/getty 38400 tty5
12  #tty6::askfirst:/bb/getty 38400 tty6
13  
14  # Stuff to do when restarting the init 
15  # process, or before rebooting.
16  ::restart:/etc/init.d/rc.shutdown
17  ::restart:/bb/init
18  ::ctrlaltdel:/bb/reboot
19  ::shutdown:/etc/init.d/rc.shutdown

'/etc/init.d/rcS'

 1  #!/bb/ash
 2  # RC Script for Tiny Core Linux
 3  # (c) Robert Shingledecker 2004-2012
 4  
 5  # Mount /proc.
 6  [ -f /proc/cmdline ] || /bb/mount /proc
 7  
 8  # Remount rootfs rw.
 9  /bb/mount -o remount,rw /
10  
11  # Mount system devices from /etc/fstab.
12  /bb/mount -a
13  
14  /etc/init.d/tc-config

'/etc/init.d/tc-config'

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

'/etc/profile'

 1  # /etc/profile: system-wide .profile file for the Bourne shells
 2  
 3  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/bb"
 4  
 5  # Prompt format for Ash (Bash use /etc/bashrc).
 6  #
 7  if [ "`id -u`" -eq 0 ]; then
 8  	# Light green and blue colored prompt.
 9  	#PS1='\e[1;31m\u@\h\e[0m:\e[1;34m\w\e[0m\# '
10   	PS1='\u@\h:\w\# '
11  else
12  	# Light green and blue colored prompt.
13   	PS1='\e[1;32m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
14  	#PS1='\u@\h:\w\$ '
15  fi
16  
17  # Screen display for X and encoding for GTK+ apps.
18  #
19  G_FILENAME_ENCODING=iso8859-1
20  
21  # ldd fake
22  #
23  which ldd > /dev/null || alias ldd=LD_TRACE_LOADED_OBJECTS=1
24  
25  # Export all variables definied above and set mask.
26  #
27  export PATH LD_LIBRARY_PATH PS1 G_FILENAME_ENCODING ignoreeof
28  umask 022
29  
30  if [ -f /etc/sysconfig/language ]; then
31  . /etc/sysconfig/language
32  export LANG LC_ALL
33  fi
34  
35  if [ -f /etc/sysconfig/timezone ]; then
36  . /etc/sysconfig/timezone
37  export TZ
38  fi
39  
40  for i in /etc/profile.d/*.sh ; do
41   if [ -r "$i" ]; then
42     . $i
43   fi
44  done

'~/.profile'

 1  # ~/.profile: Executed by Bourne-compatible login SHells.
 2  #
 3  # Path to personal scripts and executables (~/.local/bin).
 4  [ -d "$HOME/.local/bin" ] || mkdir -p "$HOME/.local/bin"
 5  export PATH=$HOME/.local/bin:$PATH
 6  
 7  ONDEMAND=/etc/sysconfig/tcedir/ondemand
 8  [ -d "$ONDEMAND" ] && export PATH=$PATH:"$ONDEMAND"
 9  
10  # Environment variables and prompt for Ash SHell
11  # or Bash. Default is a classic prompt.
12  #
13  PS1='\u@\h:\w\$ '
14  PAGER='less -EM'
15  MANPAGER='less -isR'
16  LANG=en_US.UTF8
17  
18  `which editor >/dev/null` && EDITOR=editor || EDITOR=vi
19  
20  export PS1 PAGER LANG EDITOR MANPAGER
21  
22  export BACKUP=1
23  [ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1
24  export FLWM_TITLEBAR_COLOR="58:7D:AA"
25  
26  if [ -f "$HOME/.ashrc" ]; then
27     export ENV="$HOME/.ashrc"
28     . "$HOME/.ashrc"
29  fi
30  
31  TERMTYPE=`/bb/tty`
32  [ ${TERMTYPE:5:3} == "tty" ] && (
33  [ ! -f /usr/bin/Xorg ] ||
34  [ -f /etc/sysconfig/text ] ||
35  [ -e /tmp/.X11-unix/X0 ] || 
36  startx
37  )

'~/.ashrc'

 

'~/.xinitrc'

 
Print/export