├── usr ├── bin │ ├── tce-ab │ ├── showbootcodes │ ├── exittc │ ├── tc-terminal-server │ ├── cliorx │ ├── text2lp0 │ ├── bigHomeFiles.sh │ ├── history │ ├── uuid │ ├── getdisklabel │ ├── backup │ ├── getTime.sh │ ├── calc │ ├── ldd │ ├── bbcheck.sh │ ├── tce-fetch.sh │ ├── exitcheck.sh │ ├── seekWinPartition │ ├── mountables.sh │ ├── chkonboot.sh │ ├── tce-run │ ├── version │ ├── sethostname │ ├── search.sh │ ├── tce-remove │ ├── tce-status │ ├── tcemirror.sh │ ├── select │ ├── depends-on.sh │ ├── tce-size │ ├── tce-setdrive │ ├── fromISOfile │ ├── tce │ ├── ondemand │ ├── update-everything │ ├── tce-setup │ ├── provides.sh │ ├── tce-audit │ ├── tce-update │ ├── tce-load │ └── filetool.sh ├── sbin │ ├── cache-clear │ ├── fstype │ ├── cd_dvd_symlinks.sh │ └── rebuildfstab └── share │ └── udhcpc │ └── default.script ├── etc ├── sysconfig │ └── ntpserver ├── hosts ├── init.d │ ├── tc_noscan.lst │ ├── services │ │ ├── crond │ │ ├── dhcp │ │ └── tftpd │ ├── rcS │ ├── dhcp.sh │ ├── settime.sh │ ├── tc-restore.sh │ ├── rc.shutdown │ ├── tc-functions │ └── tc-config ├── motd ├── os-release ├── skel │ ├── .ashrc │ └── .profile ├── profile ├── udev │ └── rules.d │ │ └── 50-udev-default.rules └── services ├── README ├── opt ├── bootlocal.sh ├── bootsync.sh └── shutdown.sh ├── sbin ├── ctty-hack └── autologin ├── root └── .profile ├── init ├── lib └── udev │ └── firmware.sh └── LICENSE /usr/bin/tce-ab: -------------------------------------------------------------------------------- 1 | tce -------------------------------------------------------------------------------- /etc/sysconfig/ntpserver: -------------------------------------------------------------------------------- 1 | pool.ntp.org 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Initial setup for Core scripts tracking. 2 | -------------------------------------------------------------------------------- /etc/hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 box localhost localhost.local 2 | -------------------------------------------------------------------------------- /usr/bin/showbootcodes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat /proc/cmdline 3 | -------------------------------------------------------------------------------- /usr/bin/exittc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -n "$XPID" ] && sudo kill "$XPID" 3 | -------------------------------------------------------------------------------- /opt/bootlocal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # put other system startup commands here 3 | -------------------------------------------------------------------------------- /usr/sbin/cache-clear: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sync 3 | echo 3 > /proc/sys/vm/drop_caches 4 | -------------------------------------------------------------------------------- /sbin/ctty-hack: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec setsid sh -c 'exec sh /dev/tty1 2>&1' 3 | -------------------------------------------------------------------------------- /etc/init.d/tc_noscan.lst: -------------------------------------------------------------------------------- 1 | cdrom 2 | swap 3 | pts 4 | fd 5 | ntfs 6 | sr0 7 | sr1 8 | sr2 9 | sr3 10 | -------------------------------------------------------------------------------- /usr/bin/tc-terminal-server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinycorelinux/Core-scripts/HEAD/usr/bin/tc-terminal-server -------------------------------------------------------------------------------- /usr/sbin/fstype: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -n "$1" ] || exit 1 3 | blkid -o export "$1" | awk 'BEGIN {FS="="}/^TYPE/{print $2}' 4 | -------------------------------------------------------------------------------- /etc/motd: -------------------------------------------------------------------------------- 1 | ( '>') 2 | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. 3 | (/-_--_-\) www.tinycorelinux.net 4 | 5 | -------------------------------------------------------------------------------- /usr/bin/cliorx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #Generic wrapper for hosting Terminal when called from X 3 | [ "$DISPLAY" ] && /usr/local/bin/xterm -e "$@" || "$@" 4 | -------------------------------------------------------------------------------- /usr/bin/text2lp0: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | fold -w78 $1 | sed s'/$/ /' > /dev/lp0 5 | echo -ne \\f > /dev/lp0 6 | -------------------------------------------------------------------------------- /sbin/autologin: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | if [ -f /var/log/autologin ] ; then 3 | exec /sbin/getty 38400 tty1 4 | else 5 | touch /var/log/autologin 6 | exec login -f root 7 | fi 8 | -------------------------------------------------------------------------------- /usr/bin/bigHomeFiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | find ${HOME} -type f -size +1024k | xargs ls -lSh 2>/dev/null | awk '{printf "%s\t%s\n",$5,$9}' 5 | -------------------------------------------------------------------------------- /usr/bin/history: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | # 5 | # Fake history command for Ash. 6 | # 7 | 8 | cat $HOME/.ash_history 2>/dev/null || echo "No history file found..." 9 | -------------------------------------------------------------------------------- /etc/init.d/services/crond: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "${1}" in 4 | start) 5 | crond 6 | ;; 7 | 8 | stop) 9 | pkill crond 10 | ;; 11 | 12 | status) 13 | pidof -o %PPID crond 14 | ;; 15 | 16 | *) 17 | exit 1 18 | ;; 19 | esac 20 | -------------------------------------------------------------------------------- /usr/bin/uuid: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | [ -n "$1" ] || exit 1 5 | DEVINFO="$(blkid $1)" 6 | UUID="${DEVINFO##*UUID=}" 7 | UUID="${UUID%%[ ]*}" 8 | UUID="$(echo "$UUID"|tr -d '"')" 9 | echo "$UUID" 10 | -------------------------------------------------------------------------------- /etc/init.d/services/dhcp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "${1}" in 4 | start) 5 | /etc/init.d/dhcp.sh 6 | ;; 7 | 8 | stop) 9 | pkill udhcpc 10 | ;; 11 | 12 | status) 13 | pidof udhcpc 14 | ;; 15 | 16 | *) 17 | exit 1 18 | ;; 19 | esac 20 | -------------------------------------------------------------------------------- /usr/bin/getdisklabel: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | [ -n "$1" ] || exit 1 5 | DEVINFO="$(blkid -s LABEL $1)" 6 | [ -z "$DEVINFO" ] && exit 1 7 | 8 | LABEL="${DEVINFO##*LABEL=}" 9 | LABEL="$(echo "$LABEL"|tr -d '"')" 10 | echo "$LABEL" 11 | -------------------------------------------------------------------------------- /opt/bootsync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # put other system startup commands here, the boot process will wait until they complete. 3 | # Use bootlocal.sh for system startup commands that can run in the background 4 | # and therefore not slow down the boot process. 5 | /usr/bin/sethostname box 6 | /opt/bootlocal.sh & 7 | -------------------------------------------------------------------------------- /usr/bin/backup: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | TARGET=`cat /etc/sysconfig/backup_device` 5 | [ -n "$TARGET" ] || exit 1 6 | echo "Backup device is set to: "$TARGET"" 7 | echo -n "Perform backup now? (y/N)" 8 | read ANS 9 | [ "$ANS" == "y" ] && filetool.sh -b 10 | -------------------------------------------------------------------------------- /usr/bin/getTime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | if [ -f /etc/sysconfig/ntpserver ]; then 3 | set $(cat /etc/sysconfig/ntpserver) 4 | while [ "$1" != "" ]; do 5 | NTPOPTS="$NTPOPTS -p $1" 6 | shift 7 | done 8 | else 9 | NTPOPTS="" 10 | fi 11 | /usr/sbin/ntpd -q $NTPOPTS 12 | -------------------------------------------------------------------------------- /usr/bin/calc: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | if [ -z ${1} ]; then 5 | echo 6 | echo " -=[ Simple Awk Calculator ]=-" 7 | echo "Put formula in quotes (single or double) examples:" 8 | echo "calc '3*4'" 9 | echo "calc 'sqrt(9)'" 10 | exit 0 11 | fi 12 | awk "BEGIN{ print $* }" 13 | -------------------------------------------------------------------------------- /usr/bin/ldd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for file in "$@"; do 4 | case $file in 5 | --version) echo "ldd (GNU libc)" $( /lib/libc.so.6 | awk 'NF>1{print $NF; exit }' ) 6 | break 7 | ;; 8 | */*) true 9 | ;; 10 | *) file=./$file 11 | ;; 12 | esac 13 | 14 | LD_TRACE_LOADED_OBJECTS=1 /lib/ld-linux* "$file" 15 | 16 | done 17 | 18 | -------------------------------------------------------------------------------- /etc/os-release: -------------------------------------------------------------------------------- 1 | NAME=TinyCore 2 | VERSION="12.0" 3 | ID=tinycore 4 | VERSION_ID=12.0 5 | PRETTY_NAME="TinyCoreLinux 12.0" 6 | ANSI_COLOR="0;34" 7 | CPE_NAME="cpe:/o:tinycore:tinycore_linux:12.0" 8 | HOME_URL="http://tinycorelinux.net/" 9 | SUPPORT_URL="http://forum.tinycorelinux.net/" 10 | BUG_REPORT_URL="http://forum.tinycorelinux.net/" 11 | -------------------------------------------------------------------------------- /root/.profile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | NOAUTOLOGIN=/etc/sysconfig/noautologin 3 | if [ -f "$NOAUTOLOGIN" ]; then 4 | if [ -s "$NOAUTOLOGIN" ]; then 5 | > "$NOAUTOLOGIN" 6 | exit 7 | fi 8 | else 9 | if [ ! -f /etc/sysconfig/superuser ]; then 10 | clear 11 | TCUSER="$(cat /etc/sysconfig/tcuser)" 12 | exec /bin/login -f "$TCUSER" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /etc/init.d/rcS: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # RC Script for Tiny Core Linux 3 | # (c) Robert Shingledecker 2004-2012 4 | 5 | # Mount /proc. 6 | [ -f /proc/cmdline ] || /bin/mount /proc 7 | 8 | # Remount rootfs rw. 9 | /bin/mount -o remount,rw / 10 | 11 | # Mount system devices from /etc/fstab. 12 | /bin/mount -a 13 | 14 | clear 15 | 16 | /etc/init.d/tc-config 17 | 18 | -------------------------------------------------------------------------------- /usr/bin/bbcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | busybox | sed '1,/functions:$/d' \ 5 | | tr -d ' \t\n' | tr ',' '\n' | while read F ; do 6 | L=$(which $F) 7 | T=$(ls -l $L 2> /dev/null | sed -e 's#.* -> ##' -e 's#.*/##') 8 | [ -z "$L" ] && echo "no softlink for $F" 9 | [ -n "$L" ] && [ "$T" != "busybox" ] && echo "$L not using busybox" 10 | done -------------------------------------------------------------------------------- /usr/bin/tce-fetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | #(c) Robert Shingledecker 2004-2012 3 | # 4 | . /etc/init.d/tc-functions 5 | useBusybox 6 | getMirror 7 | KERNELVER=$(uname -r) 8 | if [ "$1" == "-O" ]; then 9 | shift 10 | wget -cq -O- "$MIRROR"/"${1//-KERNEL.tcz/-${KERNELVER}.tcz}" 11 | else 12 | F="${1//-KERNEL.tcz/-${KERNELVER}.tcz}" 13 | [ -f "$F" ] && rm -f "$F" 14 | wget -cq "$MIRROR"/"$F" 15 | fi 16 | -------------------------------------------------------------------------------- /etc/init.d/services/tftpd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "${1}" in 4 | start) 5 | if [ -z "$HOME" ]; then 6 | [ "$USER" ] || USER="$(cat /etc/sysconfig/tcuser)" || USER="tc" 7 | HOME=/home/"$USER" 8 | fi 9 | /usr/bin/udpsvd -E 0 69 tftpd $HOME & 10 | ;; 11 | 12 | stop) 13 | pkill udpsvd 14 | ;; 15 | 16 | status) 17 | pidof udpsvd 18 | ;; 19 | 20 | *) 21 | exit 1 22 | ;; 23 | esac 24 | -------------------------------------------------------------------------------- /usr/bin/exitcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # Check for optional local shutdown before actual shutdown/reboot. 3 | # Called from exittc 4 | # (c) Robert Shingledecker 2006-2010 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | 8 | [ -x /opt/shutdown.sh ] && /opt/shutdown.sh 9 | 10 | ACTION="$1" 11 | case "$ACTION" in 12 | reboot ) 13 | sudo /sbin/reboot 14 | ;; 15 | shutdown ) 16 | sudo /sbin/poweroff 17 | ;; 18 | * ) 19 | sudo /sbin/poweroff 20 | ;; 21 | esac 22 | -------------------------------------------------------------------------------- /usr/bin/seekWinPartition: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2011 3 | # Use exit code to get Windows partition if any. 4 | # exit code of 0 means none found. 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | PARTNO="$(fdisk -l 2>/dev/null | grep "^/dev/$1" | awk ' 8 | { 9 | type = substr($0,52,2) 10 | if (type == " 7" || type == " c") { 11 | results = substr($1,9) 12 | print results 13 | } 14 | } ' )" 15 | [ -z "$PARTNO" ] && PARTNO="0" 16 | return "$PARTNO" 17 | -------------------------------------------------------------------------------- /usr/bin/mountables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | TEMP=/tmp/mountables$$ 5 | LIST=/tmp/mountables 6 | [ -f "$LIST" ] && rm -f "$LIST" 7 | cat /etc/fstab | awk -F '/' '/\/mnt\// {print $3}' | awk '{ sub(/[ \t]+$/, ""); print }' | sort -r | awk 'a != $0; { a = $0 }' | sort > "$TEMP" 8 | while read DEVICE; do 9 | LABEL="" 10 | [ ${DEVICE:0:2} != "fd" ] && LABEL="$(getdisklabel "/dev/$DEVICE")" 11 | echo "$DEVICE"~"$LABEL" >> "$LIST" 12 | done < "$TEMP" 13 | rm "$TEMP" 14 | -------------------------------------------------------------------------------- /usr/bin/chkonboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /etc/init.d/tc-functions 3 | BOOTLIST=`getbootparam lst` || BOOTLIST="onboot.lst" 4 | TCEDIR=/etc/sysconfig/tcedir 5 | [ -s "$TCEDIR"/"$BOOTLIST" ] || exit 1 6 | for B in $(cat "$TCEDIR"/"$BOOTLIST") 7 | do 8 | if [ -s "$TCEDIR"/optional/"$B".dep ] 9 | then 10 | for D in $(cat "$TCEDIR"/optional/"$B".dep) 11 | do 12 | if grep -q "^$D$" "$TCEDIR"/"$BOOTLIST" 13 | then 14 | echo "$D" not needed a dep of "$B" 15 | fi 16 | done 17 | fi 18 | done 19 | echo "Scan of $BOOTLIST completed." 20 | -------------------------------------------------------------------------------- /etc/skel/.ashrc: -------------------------------------------------------------------------------- 1 | # ~/.ashrc: Executed by SHells. 2 | # 3 | . /etc/init.d/tc-functions 4 | if [ -n "$DISPLAY" ] 5 | then 6 | `which editor >/dev/null` && EDITOR=editor || EDITOR=vi 7 | else 8 | EDITOR=vi 9 | fi 10 | export EDITOR 11 | 12 | # Alias definitions. 13 | # 14 | alias df='df -h' 15 | alias du='du -h' 16 | 17 | alias ls='ls -p' 18 | alias ll='ls -l' 19 | alias la='ls -la' 20 | 21 | # Avoid errors... use -f to skip confirmation. 22 | alias cp='cp -i' 23 | alias mv='mv -i' 24 | alias rm='rm -i' 25 | 26 | alias ce='cd /etc/sysconfig/tcedir' 27 | -------------------------------------------------------------------------------- /init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mount proc 3 | grep -qw multivt /proc/cmdline && sed -i s/^#tty/tty/ /etc/inittab 4 | if ! grep -qw noembed /proc/cmdline; then 5 | 6 | inodes=`grep MemFree /proc/meminfo | awk '{printf("%d\n", $2/3)}'` 7 | 8 | mount / -o remount,size=90%,nr_inodes=$inodes 9 | umount proc 10 | exec /sbin/init 11 | fi 12 | umount proc 13 | if mount -t tmpfs -o size=90% tmpfs /mnt; then 14 | if tar -C / --exclude=mnt -cf - . | tar -C /mnt/ -xf - ; then 15 | mkdir /mnt/mnt 16 | exec /sbin/switch_root mnt /sbin/init 17 | fi 18 | fi 19 | exec /sbin/init 20 | -------------------------------------------------------------------------------- /lib/udev/firmware.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" 4 | 5 | err() { 6 | echo "$@" >&2 7 | if [ -x /usr/bin/logger ]; then 8 | /usr/bin/logger -t "${0##*/}[$$]" "$@" 9 | fi 10 | } 11 | 12 | if [ ! -e /sys$DEVPATH/loading ]; then 13 | err "udev firmware loader misses sysfs directory" 14 | exit 1 15 | fi 16 | 17 | for DIR in $FIRMWARE_DIRS; do 18 | [ -e "$DIR/$FIRMWARE" ] || continue 19 | echo 1 > /sys$DEVPATH/loading 20 | cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data 21 | echo 0 > /sys$DEVPATH/loading 22 | exit 0 23 | done 24 | 25 | echo -1 > /sys$DEVPATH/loading 26 | err "Cannot find firmware file '$FIRMWARE'" 27 | exit 1 28 | -------------------------------------------------------------------------------- /usr/bin/tce-run: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2010 3 | . /etc/init.d/tc-functions 4 | useBusybox 5 | [ -z $1 ] && exit 1 6 | TARGET=$1 && EXTN=${1##/*/} 7 | shift 1 8 | APP=${EXTN%%.tcz} 9 | TCEDIR=/etc/sysconfig/tcedir 10 | [ -d "$TCEDIR" ] || exit 1 11 | [ ${TARGET} == ${EXTN} ] && TARGET=${TCEDIR}/optional/${EXTN} 12 | [ ${EXTN} == ${APP} ] && TARGET=${TARGET}.tcz 13 | if [ ! -e /usr/local/tce.installed/${APP} ]; then 14 | tce-load -is ${TARGET} 15 | fi 16 | if [ -f /usr/local/share/applications/${APP}.desktop ]; then 17 | RUN=`cat /usr/local/share/applications/${APP}.desktop | grep Exec | cut -f2 -d=` 18 | exec ${RUN} "$@" 19 | else 20 | [ $(which ${APP} ) ] && exec ${APP} "$@" 21 | fi 22 | 23 | -------------------------------------------------------------------------------- /etc/init.d/dhcp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # The DHCP portion is now separated out, in order to not slow the boot down 3 | # only to wait for slow network cards 4 | . /etc/init.d/tc-functions 5 | 6 | # This waits until all devices have registered 7 | /sbin/udevadm settle --timeout=5 8 | 9 | NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)" 10 | for DEVICE in $NETDEVICES; do 11 | ifconfig $DEVICE | grep -q "inet addr" 12 | if [ "$?" != 0 ]; then 13 | # echo -e "\n${GREEN}Network device ${MAGENTA}$DEVICE${GREEN} detected, DHCP broadcasting for IP.${NORMAL}" 14 | trap 2 3 11 15 | /sbin/udhcpc -b -i $DEVICE -x hostname:$(/bin/hostname) -p /var/run/udhcpc.$DEVICE.pid >/dev/null 2>&1 & 16 | trap "" 2 3 11 17 | sleep 1 18 | fi 19 | done 20 | -------------------------------------------------------------------------------- /etc/init.d/settime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # (c) Robert Shingledecker 2012 3 | # Bela Markus 2015 4 | 5 | # Wait for network to come up and then set time 6 | 7 | CNT=0 8 | until ifconfig | grep -q Bcast 9 | do 10 | [ $((CNT++)) -gt 60 ] && break || sleep 1 11 | done 12 | 13 | if [ $CNT -le 60 ] 14 | then 15 | CNT=9999 16 | NRT=0 17 | while sleep 0 18 | do 19 | XXX=$(/bin/date -I) 20 | XXX=${XXX:0:4} 21 | 22 | if [ "$XXX" -ge "2018" ]; 23 | then 24 | break 25 | fi 26 | 27 | if [ $CNT -gt 10 ]; 28 | then 29 | /usr/bin/getTime.sh 30 | if [ $NRT -gt 5 ]; 31 | then 32 | break 33 | fi 34 | CNT=0 35 | NRT=$((NRT+1)) 36 | fi 37 | 38 | CNT=$((CNT+1)) 39 | sleep 1 40 | done 41 | fi 42 | -------------------------------------------------------------------------------- /usr/bin/version: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | 3 | # (c) Robert Shingledecker 2009-2013 4 | # 5 | # Multiarch support added by bmarkus, 28.10.2013 6 | 7 | . /etc/init.d/tc-functions 8 | useBusybox 9 | RESULTS="$(getFullVer)" 10 | while getopts clsm OPTION 11 | do 12 | case ${OPTION} in 13 | c) LATEST=`wget -q -O - $(cat /opt/tcemirror)/latest-$(getBuild) 2>/dev/null` 14 | if [ "$?" == 0 ]; then 15 | RUNNING="${RESULTS##*-}" 16 | if [ "$LATEST" != "$RUNNING" ]; then 17 | echo "Warning:" 18 | echo "You are running version $RUNNING" 19 | echo "The latest release is $LATEST" 20 | fi 21 | fi 22 | exit 23 | ;; 24 | l) echo "$RESULTS" 25 | exit 26 | ;; 27 | s) echo "${RESULTS##*_}" 28 | exit 29 | ;; 30 | m) echo "$(getMajorVer)" 31 | exit 32 | ;; 33 | esac 34 | done 35 | echo "$RESULTS" 36 | exit 37 | -------------------------------------------------------------------------------- /opt/shutdown.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | # put user shutdown commands here 5 | # this is called from exittc, aka the gui shutdown option 6 | # if you shutdown from cli using shutdown/halt, this will not be called 7 | # 8 | # for custom cli shutdown commands, you should edit /etc/init.d/rc.shutdown 9 | 10 | # If no backup of home was done then loop through valid users to clean up. 11 | if [ ! -e /tmp/backup_done ] || ! grep -q "^home" /opt/.filetool.lst; then 12 | awk 'BEGIN { FS=":" } $3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd > /tmp/users 13 | while read U; do 14 | while read F; do 15 | TARGET="/home/${U}/$F" 16 | if [ -d "$TARGET" ]; then 17 | rm -rf "$TARGET" 18 | else 19 | if [ -f "$TARGET" ]; then 20 | rm -f "$TARGET" 21 | fi 22 | fi 23 | done < /opt/.xfiletool.lst 24 | done < /tmp/users 25 | fi 26 | -------------------------------------------------------------------------------- /usr/bin/sethostname: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # Set hostname 3 | # Originally a function contributed by henk.1955 4 | # Now callable via /opt/bootsync.sh when no boot host= is specified. 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | HOSTNAME="$(getbootparam host 2>/dev/null)" 8 | [ -n "$HOSTNAME" ] || HOSTNAME="$1" 9 | [ -n "$HOSTNAME" ] || HOSTNAME="box" 10 | echo -n "${GREEN}Setting hostname to ${MAGENTA}$HOSTNAME${NORMAL} " 11 | rm -f /etc/hostname 12 | echo $HOSTNAME >/etc/hostname 13 | hostname -F /etc/hostname 14 | rm -f /etc/hosts 15 | cat >/etc/hosts < 4 | 5 | [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 6 | 7 | RESOLV_CONF="/etc/resolv.conf" 8 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" 9 | [ -n "$subnet" ] && NETMASK="netmask $subnet" 10 | 11 | case "$1" in 12 | deconfig) 13 | /sbin/ifconfig $interface 0.0.0.0 14 | ;; 15 | 16 | renew|bound) 17 | /sbin/ifconfig $interface $ip $BROADCAST $NETMASK 18 | 19 | if [ -n "$router" ] ; then 20 | echo "deleting routers" 21 | while route del default gw 0.0.0.0 dev $interface ; do 22 | : 23 | done 24 | 25 | metric=0 26 | for i in $router ; do 27 | route add default gw $i dev $interface metric $((metric++)) 28 | done 29 | fi 30 | 31 | echo -n > $RESOLV_CONF 32 | [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF 33 | for i in $dns ; do 34 | echo adding dns $i 35 | echo nameserver $i >> $RESOLV_CONF 36 | done 37 | ;; 38 | esac 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /usr/bin/search.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | cd /tmp 5 | SEARCH="NAME" 6 | if [ "$1" == "-t" -a "$2" ]; then 7 | SEARCH="TAGS" 8 | shift 9 | fi 10 | # Now $* is the search targets 11 | [ -z "$1" ] && exit 1 12 | 13 | fetchtags() { 14 | tce-fetch.sh tags.db.gz || exit 1 15 | gunzip -f tags.db.gz 16 | touch tags.db 17 | } 18 | 19 | if [ ! -f tags.db ]; then 20 | fetchtags 21 | else # Check if the file is older than 5 hours 22 | age=$((`date +%s` - `date -r tags.db +%s`)) 23 | if [ $age -ge 18000 ]; then 24 | fetchtags 25 | fi 26 | fi 27 | 28 | if [ "$SEARCH" == "NAME" ]; then 29 | awk -v word="$1" ' 30 | BEGIN {IGNORECASE=1;} 31 | {name=$1; sub(/\.\w+$/, "", name); if (name ~ word) print $1;} 32 | ' tags.db 33 | else 34 | words="$@" 35 | awk ' 36 | BEGIN {IGNORECASE=1; split("'"$words"'", ws);} 37 | { ok=1 38 | line=$0 39 | sub(/\.\w+\s/, " ", line) 40 | for (i in ws) { 41 | if (line !~ ws[i]) { 42 | ok=0 43 | break 44 | } 45 | } 46 | if (ok) print $1 47 | }' tags.db 48 | fi 49 | -------------------------------------------------------------------------------- /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" 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 45 | -------------------------------------------------------------------------------- /usr/sbin/cd_dvd_symlinks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | #(c) Robert Shingledecker 2009 3 | # awk script to find and add symlinks for cdrom and dvd devices 4 | # typically called from /etc/udev/rules.d/75-cd-dvd.rules 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | awk ' 8 | BEGIN { 9 | c=0 10 | d=0 11 | } 12 | { 13 | if ( index($0,"drive name:") > 0 ) 14 | { 15 | if ( NF > 2 ) 16 | { 17 | for ( i=3; i<= NF; i++ ) 18 | { 19 | devices[i-2]=$i 20 | printf "/dev/%s ",$i 21 | } 22 | } 23 | } 24 | if ( index($0,"Can read DVD:") > 0 ) 25 | { 26 | if ( NF > 3 ) 27 | { 28 | for ( j=4; j <= NF; j++ ) 29 | { 30 | if ( $j == 1) 31 | { 32 | d++ 33 | dvds[d]=devices[j-3] 34 | } else { 35 | c++ 36 | cdroms[c]=devices[j-3] 37 | } 38 | } 39 | } 40 | } 41 | } 42 | END { 43 | if ( 1 in cdroms ) 44 | { 45 | system ("ln -sf /dev/"cdroms[1]" /dev/cdrom") 46 | } 47 | if ( 1 in dvds ) 48 | { 49 | system ("ln -sf /dev/"dvds[1]" /dev/dvd") 50 | if ( 1 in cdroms ) 51 | { } else { 52 | system ("ln -sf /dev/"dvds[1]" /dev/cdrom") 53 | } 54 | } 55 | } ' /proc/sys/dev/cdrom/info > /etc/sysconfig/cdroms 56 | -------------------------------------------------------------------------------- /usr/bin/tce-remove: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # (c) Robert Shingledecker 2011 3 | # 4 | # Alllow removal of uninstalled (ondemand) extensions via tce-audit/appsaudit. 5 | . /etc/init.d/tc-functions 6 | ONBOOTNAME="$(getbootparam lst 2>/dev/null)" 7 | [ -n "$ONBOOTNAME" ] || ONBOOTNAME="onboot.lst" 8 | 9 | if [ -s /tmp/audit_marked.lst ]; then 10 | > /tmp/audit_marked2.lst 11 | for F in `cat /tmp/audit_marked.lst`; do 12 | FROMDIR=`dirname "$F"` && TCEDIR=${FROMDIR%/*} 13 | EXTN=`basename "$F"`; APP=${EXTN%.tcz} 14 | if installed "$APP"; then 15 | echo "$F" >> /tmp/audit_marked2.lst 16 | else 17 | echo "$F" 18 | rm -f "$F"* 19 | LIST="$TCEDIR"/copy2fs.lst; ONBOOT="${TCEDIR}/${ONBOOTNAME}"; XWBAR="$TCEDIR"/xwbar.lst 20 | if grep -w "$EXTN" "$LIST" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$LIST"; fi 21 | if grep -w "$EXTN" "$ONBOOT" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$ONBOOT"; fi 22 | if grep -w "$EXTN" "$XWBAR" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$XWBAR"; fi 23 | [ -s "$FROMDIR"/tce.db ] && rm -f "$FROMDIR"/tce.db 24 | [ -s "$FROMDIR"/tce.lst ] && rm -f "$FROMDIR"/tce.lst 25 | ondemand -r "$APP" 26 | [ "$ICONS" == "wbar" ] && wbar_rm_icon "$APP" && wbar.sh 27 | fi 28 | done 29 | mv /tmp/audit_marked2.lst /tmp/audit_marked.lst 30 | fi 31 | -------------------------------------------------------------------------------- /usr/bin/tce-status: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | TCEDIR="/etc/sysconfig/tcedir" 5 | TCEINSTALLED="/usr/local/tce.installed" 6 | TCELIST="/tmp/tcelist" 7 | # Display installed (-i), uninstalled (-u), or orphaned (-o) 8 | 9 | [ -n "$1" ] || echo "Usage tce-status -i | -u | -o" 10 | 11 | installed() { 12 | for E in `ls "$TCEINSTALLED" 2>/dev/null`; do 13 | echo "$E" 14 | done 15 | } 16 | 17 | uninstalled() { 18 | for E in `ls "$TCEDIR"/optional/*.tcz 2>/dev/null`; do 19 | E="${E##*/}" 20 | [ -e "$TCEINSTALLED"/"${E%.tcz}" ] || echo "$E" 21 | done 22 | } 23 | 24 | orphaned() { 25 | echo 26 | getMirror 27 | echo "Standby checking for tcz files not found on:" 28 | echo "$MIRROR" 29 | echo 30 | 31 | # allow both http and https 32 | if [ "$MIRRORPROTO" != "ftp" ]; then 33 | for E in `ls "$TCEDIR"/optional/*.tcz* 2>/dev/null`; do 34 | E="${E##*/}" 35 | busybox wget --spider -q "$MIRROR"/"$E" 2>/dev/null || echo "$E not found!" 36 | done 37 | else 38 | echo "ftp mirrors currently do not support orphan file checking." 39 | echo "Select another non-ftp mirror to use this feature." 40 | fi 41 | } 42 | 43 | while getopts iuo OPTION 44 | do 45 | case ${OPTION} in 46 | i) installed ;; 47 | u) uninstalled ;; 48 | o) orphaned ;; 49 | esac 50 | done 51 | -------------------------------------------------------------------------------- /etc/skel/.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 | 17 | EDITOR=vi 18 | 19 | export PS1 PAGER FILEMGR EDITOR MANPAGER 20 | 21 | export BACKUP=1 22 | [ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1 23 | export FLWM_TITLEBAR_COLOR="58:7D:AA" 24 | 25 | if [ -f "$HOME/.ashrc" ]; then 26 | export ENV="$HOME/.ashrc" 27 | . "$HOME/.ashrc" 28 | fi 29 | 30 | read USER < /etc/sysconfig/tcuser 31 | USERID=$(id -u "$USER") 32 | XDG_RUNTIME_DIR="/run/user/$USERID" 33 | 34 | if [ ! -d "$XDG_RUNTIME_DIR" ]; then 35 | sudo mkdir -p "$XDG_RUNTIME_DIR" 36 | sudo chown "$USER":staff "$XDG_RUNTIME_DIR" 37 | sudo chmod 700 "$XDG_RUNTIME_DIR" 38 | fi 39 | export XDG_RUNTIME_DIR 40 | 41 | TERMTYPE=`/usr/bin/tty` 42 | [ ${TERMTYPE:5:3} == "tty" ] && ( 43 | [ ! -f /etc/sysconfig/Xserver ] || 44 | [ -f /etc/sysconfig/text ] || 45 | [ -e /tmp/.X11-unix/X0 ] || 46 | startx 47 | ) 48 | -------------------------------------------------------------------------------- /usr/bin/tcemirror.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | TMP=/tmp/select.$$ 5 | LOCAL=/opt/localmirrors 6 | MIRRORS="/usr/local/share/mirrors" 7 | 8 | [ -f "$LOCAL" ] && cat "$LOCAL" > "$TMP" 9 | [ -f "$MIRRORS" ] && cat "$MIRRORS" >> "$TMP" 10 | if [ ! -s "$TMP" ]; then 11 | echo "Requires mirrors.tcz extension or /opt/localmirrors" 12 | exit 1 13 | fi 14 | select "Tiny Core Linux - Mirror Selection" "$TMP" 15 | ANS="$(cat /tmp/select.ans)" 16 | rm "$TMP" 17 | 18 | [ "$ANS" == "q" ] && exit 19 | 20 | MIRRORPROTO="${ANS%%://*}" 21 | 22 | # if this is changed also change /etc/init.d/tc-functions 23 | 24 | # supported protocols for mirror 25 | if 26 | [ "$MIRRORPROTO" != "http" ] && 27 | [ "$MIRRORPROTO" != "https" ] && 28 | [ "$MIRRORPROTO" != "ftp" ]; then 29 | echo "Mirror must use http[s] or ftp" 30 | exit 1 31 | fi 32 | 33 | # https mirrors can't be done without some extensions 34 | if [ "$MIRRORPROTO" == "https" ]; then 35 | # Test if the required extensions are installed 36 | [ -e /usr/local/tce.installed/ca-certificates ] || NeedCrt=1 37 | [ -e /usr/local/tce.installed/openssl ] || NeedSSL=1 38 | 39 | if [ -n "$NeedCrt$NeedSSL" ]; then 40 | echo "The following are required before using https mirrors:" 41 | [ -n "$NeedCrt" ] && echo "ca-certificates.tcz" 42 | [ -n "$NeedSSL" ] && echo "openssl.tcz" 43 | exit 1 44 | fi 45 | fi 46 | 47 | echo "$ANS" > /opt/tcemirror 48 | -------------------------------------------------------------------------------- /usr/bin/select: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2009 3 | # $1 is title, $2 is file to read from, $3 is offset 0 or 1 (1 default) 4 | # 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | # 8 | [ -z "$2" ] && exit 1 9 | FILEIN="$2" 10 | [ "$FILEIN" == "-" ] && FILEIN=/dev/stdin 11 | OFFSET=1 12 | [ -n "$3" ] && OFFSET="$3" 13 | awk -v title="$1" -v offset="$OFFSET" -v answer="/tmp/select.ans" -v r="$(expr `stty size | cut -d" " -f1` - 2)" ' 14 | function read_console() { 15 | "head -1 < /dev/tty" | getline results 16 | close("head -1 < /dev/tty") 17 | return results 18 | } 19 | 20 | { A[NR] = $0 } 21 | 22 | END { 23 | if ( NR < 1 ) { 24 | print "q" > answer 25 | exit 26 | } 27 | if ( NR == 1 ) { 28 | print A[1] > answer 29 | exit 30 | } 31 | do { 32 | system ("clear") 33 | printf "%s\n", title 34 | for (l=1; l<=r ; l++) { 35 | ++j 36 | if ( j <= NR ) printf "\t%2d. %s\n", j, A[j] 37 | } 38 | printf "Enter selection ( 1 - %s ) or (q)uit", NR 39 | if ( NR > r ) printf ", (n)ext, (p)revious: " 40 | printf ": " 41 | selection = read_console() 42 | if (selection == "q") break 43 | if (selection == "p") { 44 | if ( j > r ) 45 | j = j - r * 2 46 | else 47 | j = 0 48 | continue 49 | } 50 | if (selection == "n" || selection == "") { 51 | if ( j > NR ) 52 | j = j - r 53 | continue 54 | } 55 | selection = selection + 0 56 | if (selection+0 < 1 || selection+0 > NR ) j = j - r 57 | } while (selection < 1 || selection > NR) 58 | if ( offset == 1 && selection != "q") 59 | print A[selection] > answer 60 | else 61 | print selection > answer 62 | } ' < "$FILEIN" 63 | -------------------------------------------------------------------------------- /etc/init.d/tc-restore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2003-2012 3 | # Called from tc-config 4 | # A non-interactive script to restore configs, directories, etc defined by the user 5 | # in the file .filetool.lst 6 | . /etc/init.d/tc-functions 7 | useBusybox 8 | 9 | TCE="$1" 10 | DEVICE="" 11 | MYDATA=mydata 12 | [ -r /etc/sysconfig/mydata ] && read MYDATA < /etc/sysconfig/mydata 13 | for i in `cat /proc/cmdline`; do 14 | case $i in 15 | *=*) 16 | case $i in 17 | restore*) 18 | RESTORE=1 19 | DEVICE=${i#*=} 20 | ;; 21 | esac 22 | ;; 23 | *) 24 | case $i in 25 | restore) RESTORE=1 ;; 26 | protect) PROTECT=1 ;; 27 | esac 28 | ;; 29 | esac 30 | done 31 | 32 | if [ -n "$PROTECT" ]; then 33 | # Check if backup file is in TCE directory 34 | if [ -d "$TCE" ] && [ -f "$TCE"/"$MYDATA".tgz.bfe ]; then 35 | DEVICE="$(echo $TCE|cut -f3- -d/)" 36 | fi 37 | if [ -z "$DEVICE" ]; then 38 | DEVICE=`tc_autoscan "$MYDATA".tgz.bfe 'f'` 39 | fi 40 | if [ -n "$DEVICE" ]; then 41 | /usr/bin/filetool.sh -r "$DEVICE" 42 | exit 0 43 | fi 44 | fi 45 | 46 | # Check if backup file is in TCE directory 47 | if [ -d "$TCE" ] && [ -f "$TCE"/"$MYDATA".tgz ]; then 48 | TCEDIR="$(echo $TCE|cut -f3- -d/)" 49 | fi 50 | 51 | if [ -z "$DEVICE" ]; then 52 | if [ -n "$TCEDIR" ]; then 53 | DEVICE="$TCEDIR" 54 | else 55 | DEVICE=`tc_autoscan "$MYDATA".tgz 'f'` 56 | fi 57 | fi 58 | 59 | if [ -n "$DEVICE" ]; then 60 | /usr/bin/filetool.sh -r "$DEVICE" 61 | exit 0 62 | fi 63 | 64 | # Nothing found, set default backup location 65 | # use persistent TCE directory 66 | if [ "${TCE:0:8}" != "/tmp/tce" ]; then 67 | DEVICE="${TCE#/mnt/}" 68 | echo "$DEVICE" > /etc/sysconfig/backup_device 69 | fi 70 | -------------------------------------------------------------------------------- /usr/bin/depends-on.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # Find which extensions depend on a particular extension. 3 | # Usage: 4 | # depends-on.sh poppler07.tcz 5 | # 6 | # Returns a list of all extensions that depend on poppler07.tcz. 7 | # Search is exact by default. Use -f flag for a fuzzy search. 8 | # 9 | # Most of this script was copied from provides.sh. Rich. 10 | 11 | . /etc/init.d/tc-functions 12 | useBusybox 13 | 14 | unset FUZZY 15 | if [ "$1" = "-f" ]; then 16 | FUZZY=1 17 | shift 18 | fi 19 | 20 | TARGET="$1" 21 | 22 | case $TARGET in 23 | ""|-h|-help|--help) 24 | echo 25 | head -n8 $0 | grep -v "!/bin/" | tr '#' ' ' 26 | echo 27 | exit 1 28 | ;; 29 | esac 30 | 31 | TCEDIR="/etc/sysconfig/tcedir" 32 | DB="dep.db" 33 | DBGZ="$DB.gz" 34 | 35 | # This downloads a fresh copy of dep.db.gz if any of the following are true: 36 | # 1. The file does not exist. 37 | # 2. The file is older than 1 hour (3600 seconds). 38 | cd "$TCEDIR" 39 | if [ -f "$DBGZ" ] 40 | then 41 | # Compute number of seconds since provides.db modified (downloaded). 42 | Age=$(( $(date +%s) - $(date -r "$DBGZ" +%s) )) 43 | if [ $Age -gt 3600 ] 44 | then 45 | # File is too old, delete it. 46 | rm "$DBGZ" 47 | fi 48 | fi 49 | if [ ! -f "$DBGZ" ] 50 | then 51 | getMirror 52 | wget -q -O "$TCEDIR"/"$DBGZ" "$MIRROR"/"$DBGZ" 53 | # Make sure it has a current timestamp. 54 | touch "$DBGZ" 55 | fi 56 | 57 | gunzip -kf "$DBGZ" 58 | 59 | cd - > /dev/null 60 | 61 | # Searching is done in 2 steps: 62 | # 1. The $0 search locates records containing a potential match and is really fast 63 | # 2. If first search succeeds, a slower search is done in fields 2 through last (which are the extension's actual dependencies) 64 | if [ -n "$FUZZY" ]; then 65 | TARGET="${TARGET%.tcz}" 66 | awk 'BEGIN {FS="\n";RS=""} {if ( $0 ~ /'$TARGET'/ ) { for (i=2; i <= NF; i++) { if ( $i ~ /'$TARGET'/ ) {print $1; next} } } }' "$TCEDIR"/"$DB" 67 | else 68 | TARGET="${TARGET%.tcz}.tcz" 69 | awk 'BEGIN {FS="\n";RS=""} {if ( $0 ~ /'$TARGET'/ ) { for (i=2; i <= NF; i++) { if ( $i == "'$TARGET'" ) {print $1} } } }' "$TCEDIR"/"$DB" 70 | fi 71 | -------------------------------------------------------------------------------- /usr/bin/tce-size: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # tce-size.sh - Copyright 2010 Brian Smith 3 | # Some edits by Curaga 4 | # Edited for use by appbrowser by roberts 5 | # Licensed under GPLv2 License 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | . /etc/init.d/tc-functions 12 | useBusybox 13 | 14 | K=1024 15 | M=$(($K * $K)) 16 | 17 | Fixed3Div() 18 | { 19 | # divide $1 by $2. Return result to 3 decimal places, no rounding. 20 | printf "%d.%03d\n" $(($1 / $2)) $(((($1 % $2) * 1000) / $2)) 21 | } 22 | 23 | get_dependencies() 24 | { 25 | 26 | for F in `sed 's/ //g' "$app".tree | sort -f | uniq`; do 27 | size=`grep -w "^$F" sizelist | awk '{print $2}'` 28 | case $size in 29 | [0-9]*) 30 | sizemb=`Fixed3Div $size $M` 31 | if [ -f "$localtce"/optional/"$F" ]; then 32 | totalsize_installed=$(($totalsize_installed + $size)) 33 | echo -n " " 34 | printf "%-40s" $F 35 | printf " %10d, %6.2f MB\n" $size $sizemb 36 | else 37 | echo -n "+ " 38 | totalsize_needed=$(($totalsize_needed + $size)) 39 | printf "%-40s %10d, %6.2f MB\n" $F $size $sizemb 40 | fi 41 | ;; 42 | *) 43 | printf "%-40s Error, not found \n" $F 44 | ;; 45 | esac 46 | done 47 | } 48 | 49 | app=$1 50 | 51 | if [ -n "$app" ]; then 52 | app=${app%.tcz} 53 | app="$app.tcz" 54 | 55 | localtce=/etc/sysconfig/tcedir 56 | 57 | cd /tmp 58 | 59 | if [ ! -f sizelist ]; then 60 | tce-fetch.sh sizelist.gz || exit 1 61 | gunzip -f sizelist.gz 62 | touch sizelist 63 | else # Check if the file is older than 5 hours 64 | age=$((`date +%s` - `date -r sizelist +%s`)) 65 | if [ $age -ge 18000 ]; then 66 | tce-fetch.sh sizelist.gz || exit 1 67 | gunzip -f sizelist.gz 68 | touch sizelist 69 | fi 70 | fi 71 | tce-fetch.sh "$app".tree >/dev/null 2>&1 || echo "$app" > "$app".tree 72 | 73 | totalsize_needed=0 74 | totalsize_installed=0 75 | 76 | get_dependencies $app 77 | 78 | totalsize=$(($totalsize_needed + $totalsize_installed)) 79 | totalsizemb=`Fixed3Div $totalsize $M` 80 | totalsize_neededmb=`Fixed3Div $totalsize_needed $M` 81 | totalsize_installedmb=`Fixed3Div $totalsize_installed $M` 82 | 83 | printf "\n %-40s %10d, %6.2f MB\n" "Total size (bytes)" $totalsize $totalsizemb 84 | printf "+ %-40s %10d, %6.2f MB\n" "Indicates need to download" $totalsize_needed $totalsize_neededmb 85 | else 86 | echo "Specify extension in command line:" 87 | echo "Example: $0 firefox.tcz" 88 | fi 89 | -------------------------------------------------------------------------------- /etc/init.d/rc.shutdown: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # /etc/init.d/rc.shutdown - used by /etc/inittab to shutdown the system. 3 | # 4 | . /etc/init.d/tc-functions 5 | useBusybox 6 | 7 | clear 8 | # Sync all filesystems. 9 | echo "${BLUE}Syncing all filesystems." 10 | sync; sync 11 | 12 | if ! grep -q "noswap" /proc/cmdline; then 13 | echo "${BLUE}Disabling swap space.${NORMAL}" 14 | swapoff -a 2>/dev/null 15 | fi 16 | 17 | # Kill all processes except those listed in /var/tmp/k5_skip. 18 | K5_SKIP=$(awk 'BEGIN {RS="[\n ]";ORS=" "}{print "-o "$1}' /var/tmp/k5_skip) 19 | echo "${RED}Killing $K5_SKIP all processes." 20 | killall5 $K5_SKIP && sleep 2 21 | echo "Terminating $K5_SKIP all processes." 22 | killall5 -9 $K5_SKIP 23 | echo -n "${NORMAL}" 24 | 25 | # Unmount all tcz extensions that were mounted into /tmp/tcloop via loopback 26 | for loop in $(mount | awk '/\/tmp\/tcloop/{print substr($1,10,3)}'|sort -nr); do umount -d /dev/loop"$loop" 2>/dev/null; done 27 | # Unmount all scm extensions that were mounted into /apps via loopback 28 | for loop in $(mount | awk '/\/apps/{print substr($1,10,3)}'|sort -nr); do umount -d /dev/loop"$loop" 2>/dev/null; done 29 | 30 | if [ -s /tmp/audit_marked.lst ]; then 31 | echo "${BLUE}Removing requested extensions:" 32 | ONBOOTNAME="$(getbootparam lst 2>/dev/null)" 33 | [ -n "$ONBOOTNAME" ] || ONBOOTNAME="onboot.lst" 34 | for F in `cat /tmp/audit_marked.lst`; do 35 | echo "${YELLOW}$F" 36 | rm -f "$F"* 37 | FROMDIR=`dirname "$F"` && TCEDIR=${FROMDIR%/*} 38 | EXTN=`basename "$F"`; APP=${EXTN%.tcz} 39 | LIST="$TCEDIR"/copy2fs.lst; ONBOOT="${TCEDIR}/${ONBOOTNAME}"; XWBAR="$TCEDIR"/xwbar.lst 40 | if grep -w "$EXTN" "$LIST" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$LIST"; fi 41 | if grep -w "$EXTN" "$ONBOOT" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$ONBOOT"; fi 42 | if grep -w "$EXTN" "$XWBAR" >/dev/null 2>&1; then sed -i '/'"$EXTN"'/d' "$XWBAR"; fi 43 | [ -s "$FROMDIR"/tce.db ] && rm -f "$FROMDIR"/tce.db 44 | [ -s "$FROMDIR"/tce.lst ] && rm -f "$FROMDIR"/tce.lst 45 | rm -f "$TCEDIR"/ondemand/$APP* 2>/dev/null 46 | done 47 | rm -f /tmp/audit_marked.lst 48 | sync; sleep 1; sync; sleep 1 49 | echo "${NORMAL}" 50 | fi 51 | 52 | # Umount filesystems. 53 | echo "${BLUE}Unmounting all filesystems. " 54 | echo -n "${NORMAL}" 55 | 56 | TCE=$(readlink /etc/sysconfig/tcedir) 57 | if [ -d "$TCE" ]; then 58 | TCEMOUNT=${TCE%/*} 59 | [ -z "$TCEMOUNT" ] || umount "$TCEMOUNT" 2>/dev/null 60 | fi 61 | 62 | if [ -s /etc/sysconfig/backup_device ]; then 63 | BACKUP=`cat /etc/sysconfig/backup_device` 64 | BACKUPDEVICE=/mnt/${BACKUP%/*} 65 | umount "$BACKUPDEVICE" 2>/dev/null 66 | fi 67 | 68 | umount -arf >/dev/null 2>&1 69 | 70 | echo "Shutdown in progress." 71 | sync 72 | echo "" 73 | -------------------------------------------------------------------------------- /usr/bin/tce-setdrive: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2010 3 | # After boot setup for TCE directory and backup 4 | . /etc/init.d/tc-functions 5 | useBusybox 6 | 7 | MYDATA=mydata 8 | [ -r /etc/sysconfig/mydata ] && read MYDATA < /etc/sysconfig/mydata 9 | fetchDriveList() { 10 | TMP="/tmp/tcesetdev" 11 | TMP2="/tmp/tcesetdev2.$$" 12 | awk '/mnt/{printf "%s\n",$2}' /etc/fstab|sort -n > "$TMP" 13 | while read F; do 14 | if grep -qv ${F##*/} /etc/sysconfig/cdroms 2>/dev/null; then echo $F >> "$TMP2"; fi 15 | done < "$TMP" 16 | [ -s "$TMP2" ] && mv "$TMP2" "$TMP" 17 | [ -s "$TMP" ] || rm "$TMP" 18 | } 19 | 20 | setupSelectedDrive() { 21 | DEVICE="$ANSWER" 22 | LOCAL_DEVICE="${DEVICE##/*/}" 23 | [ -z "$LOCAL_DEVICE" ] && exit 1 24 | find_mountpoint "$LOCAL_DEVICE" 25 | if [ -n "$MOUNTPOINT" ]; then 26 | if [ "$MOUNTED" == "no" ]; then 27 | mount "$MOUNTPOINT" 28 | fi 29 | fi 30 | 31 | TCEDIR="$ANSWER"/tce 32 | if [ ! -d "$TCEDIR"/optional ]; then 33 | sudo /bin/mkdir -p "$TCEDIR"/optional 34 | [ "$?" == 0 ] || exit 1 35 | sudo /bin/chown -R ${USER}:staff "$TCEDIR" 2>/dev/null 36 | sudo /bin/chmod -R g+w "$TCEDIR" 2>/dev/null 37 | fi 38 | [ -f "$TCEDIR"/${MYDATA}.tgz ] || touch "$TCEDIR"/${MYDATA}.tgz 39 | [ -s /etc/sysconfig/backup_device ] || echo "${TCEDIR#/mnt/}" > /etc/sysconfig/backup_device 40 | sudo /bin/rm -f /etc/sysconfig/tcedir 41 | sudo /bin/ln -s ${TCEDIR} /etc/sysconfig/tcedir 42 | } 43 | 44 | abort() { 45 | echo "Usage: tce-setdrive { -l | -s }" 46 | exit 1 47 | } 48 | 49 | # Main 50 | unset LIST SETUP 51 | 52 | while getopts ls OPTION 53 | do 54 | case ${OPTION} in 55 | l) LIST=TRUE ;; 56 | s) SETUP=TRUE ;; 57 | *) abort ;; 58 | esac 59 | done 60 | shift `expr $OPTIND - 1` 61 | 62 | if [ ${LIST} ]; then 63 | fetchDriveList 64 | [ -s "$TMP" ] || exit 1 65 | exit 0 66 | fi 67 | 68 | if [ ${SETUP} ]; then 69 | ANSWER="$1" 70 | [ -z ${ANSWER} ] && exit 1 71 | setupSelectedDrive 72 | exit 0 73 | fi 74 | 75 | TCEDIR="$(readlink /etc/sysconfig/tcedir)" 76 | [ -d "$TCEDIR" ] || exit 1 77 | if [ "${TCEDIR:0:8}" != "/tmp/tce" ]; then 78 | echo 79 | sudo /bin/chown -R "$USER":staff "$TCEDIR" 2>/dev/null 80 | sudo /bin/chmod -R g+w "$TCEDIR" 2>/dev/null 81 | echo -n "${GREEN}Your TCE Drive, $TCEDIR, has already been selected!${NORMAL}" 82 | sleep 3 83 | exit 1 84 | fi 85 | 86 | fetchDriveList 87 | 88 | [ -s "$TMP" ] || exit 1 89 | echo "${GREEN}" 90 | select "tce-setdrive - Choose Drive for TCE directory" "$TMP" 1 91 | echo "${NORMAL}" 92 | ANSWER=`cat /tmp/select.ans`;rm "$TMP" 93 | [ "$ANSWER" == "q" ] && exit 1 94 | 95 | setupSelectedDrive 96 | 97 | echo 98 | echo -n "${GREEN}Your TCE Drive, $TCEDIR, is now enabled!${NORMAL}" 99 | sleep 5 100 | echo 101 | exit 0 102 | -------------------------------------------------------------------------------- /usr/bin/fromISOfile: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2012 3 | # Load cde from iso file 4 | # At boot - called from tc-config with: iso=sdb1 5 | # After boot in /opt/bootsync.sh with /usr/bin/fromISOfile sdb1 6 | # After boot from command line with: sudo fromISOfile sdb1 7 | . /etc/init.d/tc-functions 8 | useBusybox 9 | checkroot 10 | [ -z "$1" ] && exit 1 11 | read USER < /etc/sysconfig/tcuser || exit 1 12 | [ -d /mnt/cdrom ] || mkdir /mnt/cdrom 13 | TARGET="$1" 14 | TARGET="${TARGET#/mnt/}" 15 | TARGET="${TARGET#/dev/}" 16 | DEVICE="${TARGET%%/*}" 17 | if [ "${TARGET##*.}" == "iso" ] 18 | then 19 | TARGET="${TARGET#*/}" 20 | else 21 | TARGET="" 22 | fi 23 | 24 | find_mountpoint "$DEVICE" 25 | if [ -z "$MOUNTPOINT" ]; then 26 | echo "Invalid device specified: $DEVICE" 27 | exit 1 28 | fi 29 | if ! mounted "$MOUNTPOINT"; then 30 | mount "$MOUNTPOINT" 31 | if [ "$?" != 0 ]; then 32 | echo "Unable to mount drive!" 33 | exit 1 34 | fi 35 | fi 36 | if [ -z "$TARGET" ]; then 37 | find "$MOUNTPOINT" -name "*.iso" > /tmp/isos.lst 38 | FOUND="$(awk '{print NR}' /tmp/isos.lst 2>/dev/null)" || FOUND=0 39 | if [ "$FOUND" == 0 ]; then 40 | echo "No iso file found on /mnt/$DEVICE" 41 | exit 1 42 | fi 43 | if [ "$FOUND" == 1 ]; then 44 | TARGET=$(cat /tmp/isos.lst) 45 | else 46 | echo "Multiple isos found, please use full path." 47 | cat /tmp/isos.lst 48 | exit 1 49 | fi 50 | else 51 | TARGET="$MOUNTPOINT"/"$TARGET" 52 | fi 53 | echo "$TARGET" 54 | mount -t iso9660 -o ro "$TARGET" /mnt/cdrom 55 | if [ "$?" != 0 ]; then 56 | echo "Failed to mount specified $TARGET" 57 | exit 1 58 | fi 59 | if [ ! -d /mnt/cdrom/cde ]; then 60 | echo "no cde directory found in $TARGET" 61 | umount /mnt/cdrom 62 | exit 1 63 | fi 64 | echo "Loading onboot.lst from embedded cde directory." 65 | LOADFROM=/mnt/cdrom/cde/optional 66 | CDELIST=/mnt/cdrom/cde/onboot.lst 67 | if [ -s "$CDELIST" ]; then 68 | while read FILE; do 69 | FILE="$LOADFROM/$FILE" 70 | BASENAME=`basename "$FILE"` 71 | APPNAME="${BASENAME%.tcz}" 72 | if [ ! -f "$TCEINSTALLED"/"$APPNAME" ]; then 73 | FLAGS=" -i -b " 74 | su "$USER" -c 'tce-load '"$FLAGS"' '"$FILE" 75 | if [ -s /tmp/aberr ]; then 76 | echo "occured while loading: " "$FILE" >> /tmp/aberr 77 | umount /mnt/cdrom 78 | exit 1 79 | fi 80 | fi 81 | done < "$CDELIST" 82 | echo "$LOADFROM" > /etc/sysconfig/cde 83 | else 84 | echo "No onboot.lst from in cde directory." 85 | umount /mnt/cdrom 86 | exit 1 87 | fi 88 | 89 | # Wrap up by performing updates as may be needed. 90 | if [ -e /etc/sysconfig/newmodules ]; then 91 | depmod -a 2>/dev/null 92 | /sbin/udevadm trigger 93 | fi 94 | /sbin/ldconfig 2>/dev/null 95 | if [ -s /tmp/setup.lst ]; then 96 | for F in `cat /tmp/setup.lst`; do "$F"; done 97 | rm -f /tmp/setup.lst 98 | fi 99 | setupHome 100 | -------------------------------------------------------------------------------- /usr/bin/tce: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Tiny Core Browser 3 | # (c) Robert Shingledecker 2009-2012 4 | . /etc/init.d/tc-functions 5 | trap 'echo; exit 1 1>&2' 1 2 15 6 | 7 | # check that the mirror is valid here 8 | getMirror 9 | 10 | searchInfoList() { 11 | clear 12 | if [ ! -n "$ITEM" ] || [ ${ITEM:0:1} == "-" ]; then 13 | echo -n "Enter starting chars of desired extension, e.g. abi: "; read ITEM 14 | [ ! -n "$ITEM" ] && quit 15 | fi 16 | search.sh "$ITEM" > info.lst 17 | } 18 | 19 | whatProvides() { 20 | clear 21 | if [ ! -n "$ITEM" ] || [ ${ITEM:0:1} == "-" ]; then 22 | echo -n "Enter search term, e.g. iwconfig: "; read ITEM 23 | [ ! -n "$ITEM" ] && quit 24 | fi 25 | provides.sh "$ITEM" > info.lst 26 | } 27 | 28 | keywordSearch() { 29 | clear 30 | if [ ! -n "$ITEM" ] || [ ${ITEM:0:1} == "-" ]; then 31 | echo -n "Enter search term(s), e.g. browser: "; read ITEM 32 | [ ! -n "$ITEM" ] && quit 33 | fi 34 | search.sh -t "$ITEM" > info.lst 35 | } 36 | 37 | selectItem(){ 38 | select "tce - Tiny Core Extension browser" info.lst 39 | EXTN="$(cat /tmp/select.ans)" 40 | [ "$EXTN" == "q" ] && unset EXTN 41 | } 42 | 43 | displayInfo(){ 44 | if [ -n "$EXTN" ]; then 45 | tce-fetch.sh "$EXTN".info 46 | less "$EXTN".info 47 | rm "$EXTN".info 48 | fi 49 | } 50 | 51 | displayDepends(){ 52 | tce-fetch.sh "$EXTN".dep 2>/dev/null 53 | if [ "$?" == 0 ]; then 54 | less "$EXTN".dep 55 | rm "$EXTN".dep 56 | fi 57 | } 58 | 59 | displayTree(){ 60 | tce-fetch.sh "$EXTN".tree 2>/dev/null 61 | if [ "$?" == 0 ]; then 62 | less "$EXTN".tree 63 | rm "$EXTN".tree 64 | fi 65 | } 66 | 67 | displaySize(){ 68 | clear 69 | tce-size "$EXTN" 70 | } 71 | 72 | displayFiles(){ 73 | tce-fetch.sh "$EXTN".list 74 | less "$EXTN".list 75 | rm "$EXTN".list 76 | } 77 | 78 | quit(){ 79 | rm -f info.lst* /tmp/tags.lst /tmp/select.ans > /dev/null 80 | cd - > /dev/null 81 | rm -rf $TMPDIR 2>/dev/null 82 | exit 0 83 | } 84 | 85 | # Main 86 | checknotroot 87 | TMPDIR=`mktemp -d -t` 88 | cd $TMPDIR 89 | clear 90 | echo "tce-ab - Tiny Core Extension: Application Browser" 91 | echo 92 | while true; do 93 | [ -n "$EXTN" ] && echo -e "\033[40;37;7m $EXTN \033[0m" && echo -n "A)bout I)nstall doW)nload + load O)nDemand D)epends T)ree F)iles siZ)e L)ist " 94 | echo -n "S)earch P)rovides K)eywords or Q)uit: "; read -s -n1 ANS; echo 95 | case ${ANS} in 96 | A|a) displayInfo ;; 97 | I|i) tce-load -w -i "$EXTN" ;; 98 | W|w) tce-load -w -i -l "$EXTN" ;; 99 | O|o) tce-load -w -o "$EXTN" ;; 100 | D|d) displayDepends ;; 101 | T|t) displayTree ;; 102 | Z|z) displaySize ;; 103 | F|f) displayFiles ;; 104 | L|l) selectItem ;; 105 | S|s) ITEM="" && searchInfoList "$ITEM" && selectItem; displayInfo ;; 106 | P|p) ITEM="" && whatProvides "$ITEM" && selectItem; displayInfo ;; 107 | K|k) ITEM="" && keywordSearch "$ITEM" && selectItem; displayInfo ;; 108 | Q|q) quit ;; 109 | *) ;; #displayInfo ;; 110 | esac 111 | done 112 | -------------------------------------------------------------------------------- /usr/bin/ondemand: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2009-2012 3 | . /etc/init.d/tc-functions 4 | useBusybox 5 | 6 | selectList() { 7 | TMPFILE=`mktemp` 8 | for F in `ls ${TCEDIR}/${DIRNAME}/*${TYPE}`; do 9 | ITEM="${F##*/}" 10 | ADDITEM=1 11 | 12 | # Exclude onboot items from select for on demand. 13 | [ "$TYPE" == "tcz" ] && if grep -qw "$ITEM" "$TCEDIR"/"$ONBOOTNAME"; then ADDITEM=0; fi 14 | 15 | # Exclude current ondemand items from select 16 | [ -e "$TCEDIR"/ondemand/"$ITEM" ] && ADDITEM=0 17 | 18 | [ "$ADDITEM" == "1" ] && echo "$ITEM" >> "$TMPFILE" 19 | done 20 | 21 | sort -f "$TMPFILE" 22 | rm -f "$TMPFILE" 23 | } 24 | 25 | TCEDIR=/etc/sysconfig/tcedir 26 | [ -d "$TCEDIR" ] || exit 1 27 | WBAR_ICON_DIR="/usr/local/tce.icons" 28 | FREEDESKTOP=/usr/local/share/applications 29 | 2>/dev/null read DESKTOP < /etc/sysconfig/desktop 30 | 31 | LOCALDIR="$HOME"/.local/share/applications 32 | 33 | [ -d /mnt/test ] || sudo /bin/mkdir -p /mnt/test 34 | 35 | while getopts clter OPTION 36 | do 37 | case ${OPTION} in 38 | c) CURRITEMS=1 ;; 39 | l) LISTITEMS=1 ;; 40 | t) TCZ=1; TYPE="tcz" ;; 41 | e) EXECITEM=1 ;; 42 | r) REMOVEITEM=1 ;; 43 | *) exit 1 ;; 44 | esac 45 | done 46 | shift `expr $OPTIND - 1` 47 | 48 | [ -n "$TYPE" ] || TYPE="tcz" 49 | 50 | ONBOOTNAME="$(getbootparam lst 2>/dev/null)" 51 | if [ -z "$ONBOOTNAME" ]; then 52 | [ "$TYPE" == "tcz" ] && ONBOOTNAME="onboot.lst" 53 | fi 54 | 55 | [ "$TYPE" == "tcz" ] && DIRNAME="optional" 56 | 57 | if [ "$LISTITEMS" ]; then 58 | selectList 59 | exit 0 60 | fi 61 | 62 | if [ "$CURRITEMS" ]; then 63 | for F in `ls "$TCEDIR"/ondemand/*` 64 | do 65 | grep -l ."$TYPE" "$F" | awk 'BEGIN{FS="/"}{print $NF}' 66 | done 67 | exit 0 68 | fi 69 | 70 | if [ "$REMOVEITEM" ]; then 71 | [ -z "$1" ] && exit 1 72 | TYPE="${1##*.}" 73 | [ "$TYPE" == "tcz" ] && APPNAME="${1%.tcz}" || APPNAME="$1" 74 | 75 | TARGET="$TCEDIR"/ondemand/"$APPNAME" 76 | if [ -e "$TARGET" ]; then 77 | rm -f "$TARGET" 78 | [ $(which "$DESKTOP"_ondemand) ] && "$DESKTOP"_ondemand 2>/dev/null 79 | [ $(which "$DESKTOP"_restart) ] && "$DESKTOP"_restart 2>/dev/null 80 | fi 81 | exit 0 82 | fi 83 | 84 | if [ -n "$1" ]; then 85 | EXTN="$1" 86 | APPNAME="${EXTN%.*}" 87 | if [ "$APPNAME" == "$EXTN" ]; then 88 | echo ".tcz is required." 89 | exit 1 90 | fi 91 | else 92 | exit 1 93 | fi 94 | 95 | if [ "$EXECITEM" ]; then 96 | TYPE="${1##*.}" 97 | if [ "$TYPE" == "tcz" ] 98 | then 99 | FROMWHERE="$TCEDIR"/"optional/" 100 | COMMAND="tce-load -is" 101 | fi 102 | INSTALLED=/usr/local/tce.installed 103 | if [ ! -e "$INSTALLED"/"$APPNAME" ]; then 104 | shift 1 && ${COMMAND} "$FROMWHERE""$APPNAME"."$TYPE" && launchApp "$APPNAME" "$@" 105 | else 106 | shift 1 && launchApp "$APPNAME" "$@" 107 | fi 108 | exit 0 109 | fi 110 | 111 | # Arrive here if no flags were specified. 112 | # Create ondemand item.... 113 | # Generic shell script for OnDemand by all WMs 114 | [ -d "$TCEDIR"/ondemand ] || mkdir -p "$TCEDIR"/ondemand 115 | FILE="$TCEDIR"/ondemand/"$APPNAME" 116 | echo '#!/bin/sh' > "$FILE" 117 | echo 'ondemand -e '"$EXTN"' "$@"' >> "$FILE" 118 | chmod +x "$FILE" 119 | 120 | # Optional as flwm does not need a make_ondemand. 121 | [ $(which ${DESKTOP}_ondemand) ] && ${DESKTOP}_ondemand "$APPNAME" 122 | 123 | if [ $(which ${DESKTOP}_restart) ]; then 124 | ${DESKTOP}_restart 125 | fi 126 | -------------------------------------------------------------------------------- /usr/sbin/rebuildfstab: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # Original author Robert Shingledecker 2004 3 | # Changes by other authors over the years, see git 4 | # Larger rewrite by Richard A. Rost March 5, 2023 5 | 6 | . /etc/init.d/tc-functions 7 | useBusybox 8 | 9 | PATH="/bin:/sbin:/usr/bin:/usr/sbin" 10 | export PATH 11 | umask 022 12 | 13 | # Exit if script is already running 14 | [ -e /proc/partitions ] || exit 15 | if [ -e /var/run/rebuildfstab.pid ]; then 16 | if [ -e "/proc/$(cat /var/run/rebuildfstab.pid)" ]; then 17 | touch /var/run/rebuildfstab.rescan 2>/dev/null 18 | exit 19 | fi 20 | rm -f /var/run/rebuildfstab.pid 21 | fi 22 | echo "$$" >/var/run/rebuildfstab.pid 23 | 24 | 25 | MyPID="$$" 26 | TMP="/tmp/fstab.$MyPID.tmp" 27 | ADDEDBY="# Added by TC" 28 | DEVROOT="/dev" 29 | 30 | # Read a list of CDROM/DVD Drives 31 | CDROMS="" 32 | CDROMSF=/etc/sysconfig/cdroms 33 | [ -s "$CDROMSF" ] && CDROMS=`cat "$CDROMSF"` 34 | 35 | NTFSDRIVER="" 36 | checkntfs() { 37 | if [ -z "$NTFSDRIVER" ]; then 38 | if [ -f /usr/bin/ntfs-3g ] || [ -f /usr/local/bin/ntfs-3g ] || [ -f /bin/ntfs-3g ]; then 39 | NTFSDRIVER="ntfs-3g" 40 | else 41 | NTFSDRIVER="ntfs3" 42 | fi 43 | fi 44 | 45 | FSTYPE="$NTFSDRIVER" 46 | case "$FSTYPE" in 47 | ntfs3|ntfs-3g) OPTIONS="$OPTIONS",iocharset=utf8; ;; 48 | ntfs) OPTIONS="$OPTIONS,ro,umask=000"; ;; 49 | esac 50 | } 51 | 52 | # Create base fstab file (previous rebuildfstab additions removed). 53 | rm -f "$TMP" 54 | Custom="" 55 | while read -r Device Line 56 | do 57 | case $Device$Line in 58 | *"$ADDEDBY"*) # Skip entries added by TC. 59 | continue 60 | ;; 61 | 62 | "/dev/"*) # Save a list of custom entries. 63 | Custom="$Custom ${Device##*/}" 64 | printf "%-15s %s\n" "$Device" "$Line" >> "$TMP" 65 | ;; 66 | 67 | "#"*) # Comments 68 | echo "$Device $Line" >> "$TMP" 69 | ;; 70 | 71 | *) # Base entries, proc, sysfs, tmpfs, ... 72 | printf "%-15s %s\n" "$Device" "$Line" >> "$TMP" 73 | ;; 74 | esac 75 | done < /etc/fstab 76 | 77 | # Loop through block devices 78 | DevList="" 79 | while read -r DEVMAJOR DEVMINOR BLOCKS DEVNAME 80 | do 81 | # name and "" filter out header and blank lines. 82 | case $DEVNAME in 83 | *loop*|*ram*|name|"") 84 | continue 85 | ;; 86 | esac 87 | 88 | # Custom mounts were already processed. 89 | case "$Custom" in 90 | *"$DEVNAME"*) 91 | continue 92 | ;; 93 | esac 94 | 95 | MOUNTPOINT="/mnt/$DEVNAME" 96 | OPTIONS="noauto,users,exec" 97 | FSTYPE="" 98 | 99 | # Set removable devices to auto. 100 | case "$CDROMS" in *"$DEVROOT/$DEVNAME"*) FSTYPE="auto" ;; esac 101 | # Avoid probing floppy drives. 102 | [ $DEVMAJOR -eq 2 ] && FSTYPE="auto" 103 | 104 | if [ "$FSTYPE" == "auto" ] 105 | then 106 | printf "%-15s %-15s %-8s %-20s %-s\n" "$DEVROOT/$DEVNAME" "$MOUNTPOINT" "$FSTYPE" "$OPTIONS" "0 0 $ADDEDBY" >> "$TMP" 107 | mkdir -p "$MOUNTPOINT" 2>/dev/null >/dev/null 108 | continue 109 | fi 110 | 111 | # Remaining devices get collected here. 112 | DevList="$DevList $DEVROOT/$DEVNAME" 113 | done < /proc/partitions 114 | 115 | if [ -n "$DevList" ]; then 116 | blkid -s TYPE $DevList | tr -d ':"' | while read -r DEVNAME TYPE 117 | do 118 | MOUNTPOINT="/mnt/${DEVNAME##*/}" 119 | FSTYPE="${TYPE#*=}" 120 | OPTIONS="noauto,users,exec" 121 | 122 | # Skip these file system types. 123 | case "$FSTYPE" in linux_raid_member|LVM2_member|zfs_member) continue; ;; esac 124 | 125 | case "$FSTYPE" in 126 | ntfs) checkntfs ;; 127 | vfat|msdos) OPTIONS="${OPTIONS},umask=000" ;; 128 | swap) OPTIONS="defaults"; MOUNTPOINT="none" ;; 129 | esac 130 | 131 | if [ "$MOUNTPOINT" != "none" ]; then 132 | mkdir -p "$MOUNTPOINT" 2>/dev/null >/dev/null 133 | fi 134 | 135 | # Add entry to new fstab file. 136 | printf "%-15s %-15s %-8s %-20s %-s\n" "$DEVNAME" "$MOUNTPOINT" "$FSTYPE" "$OPTIONS" "0 0 $ADDEDBY" >> "$TMP" 137 | done 138 | fi 139 | 140 | # Move new fstab file to its proper location. 141 | mv -f "$TMP" /etc/fstab 142 | 143 | # Clean up 144 | rm -f /var/run/rebuildfstab.pid 145 | sync 146 | 147 | # If another copy tried to run while we were running, rescan. 148 | if [ -e /var/run/rebuildfstab.rescan ]; then 149 | rm -f /var/run/rebuildfstab.rescan 150 | exec $0 "$@" 151 | fi 152 | -------------------------------------------------------------------------------- /etc/udev/rules.d/50-udev-default.rules: -------------------------------------------------------------------------------- 1 | # do not edit this file, it will be overwritten on update 2 | 3 | KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="staff", MODE="0660" 4 | KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="staff", MODE="0660" 5 | KERNEL=="ptmx", GROUP="staff", MODE="0666" 6 | KERNEL=="tty", GROUP="staff", MODE="0666" 7 | KERNEL=="tty[0-9]*", GROUP="staff", MODE="0620" 8 | KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="staff" 9 | 10 | # serial 11 | KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="staff" 12 | KERNEL=="mwave", GROUP="staff" 13 | KERNEL=="hvc*|hvsi*", GROUP="staff" 14 | 15 | # virtio serial / console ports 16 | KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" 17 | 18 | # mem 19 | KERNEL=="null|zero|full|random|urandom", MODE="0666" 20 | KERNEL=="mem|kmem|port|nvram", GROUP="staff", MODE="0640" 21 | 22 | # input 23 | SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" 24 | KERNEL=="mouse*|mice|event*", MODE="0640" 25 | KERNEL=="ts[0-9]*|uinput", MODE="0644", GROUP="staff" 26 | KERNEL=="js[0-9]*", MODE="0644" 27 | 28 | # video4linux 29 | SUBSYSTEM=="video4linux", GROUP="staff" 30 | KERNEL=="vttuner*", GROUP="staff" 31 | KERNEL=="vtx*|vbi*", GROUP="staff" 32 | KERNEL=="winradio*", GROUP="staff" 33 | 34 | # graphics 35 | KERNEL=="agpgart", GROUP="staff" 36 | KERNEL=="pmu", GROUP="staff" 37 | KERNEL=="nvidia*|nvidiactl*", GROUP="staff" 38 | SUBSYSTEM=="graphics", GROUP="staff" 39 | SUBSYSTEM=="drm", GROUP="staff" 40 | 41 | # sound 42 | SUBSYSTEM=="sound", GROUP="staff", \ 43 | OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" 44 | 45 | # DVB (video) 46 | SUBSYSTEM=="dvb", GROUP="staff" 47 | 48 | # DVB (media) 49 | SUBSYSTEM=="media", GROUP="staff" 50 | 51 | # FireWire (firewire-core driver: IIDC devices, AV/C devices) 52 | SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="staff" 53 | SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="staff" 54 | SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="staff" 55 | SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="staff" 56 | 57 | # 'libusb' device nodes 58 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="staff" 59 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" 60 | 61 | # printer 62 | KERNEL=="parport[0-9]*", GROUP="staff" 63 | SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="staff" 64 | SUBSYSTEM=="ppdev", GROUP="staff" 65 | SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="staff" 66 | KERNEL=="lp[0-9]*", GROUP="staff" 67 | KERNEL=="irlpt[0-9]*", GROUP="staff" 68 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="staff" 69 | 70 | # block 71 | SUBSYSTEM=="block", GROUP="staff" 72 | 73 | # floppy 74 | SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="staff" 75 | 76 | # cdrom 77 | SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="staff" 78 | SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="staff" 79 | KERNEL=="pktcdvd[0-9]*", GROUP="staff" 80 | KERNEL=="pktcdvd", GROUP="staff" 81 | 82 | # tape 83 | KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="staff" 84 | KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="staff" 85 | SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="staff" 86 | 87 | # block-related 88 | KERNEL=="sch[0-9]*", GROUP="staff" 89 | SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="staff" 90 | KERNEL=="pg[0-9]*", GROUP="staff" 91 | KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="staff" 92 | KERNEL=="rawctl", GROUP="staff" 93 | SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="staff" 94 | SUBSYSTEM=="aoe", GROUP="staff", MODE="0220" 95 | SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" 96 | 97 | # network 98 | KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" 99 | KERNEL=="rfkill", GROUP="staff", MODE="0664" 100 | 101 | # CPU 102 | KERNEL=="cpu[0-9]*", MODE="0444" 103 | 104 | KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse", \ 105 | RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" 106 | 107 | SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" 108 | KERNEL=="mmtimer", MODE="0644" 109 | KERNEL=="rflash[0-9]*", MODE="0400" 110 | KERNEL=="rrom[0-9]*", MODE="0400" 111 | -------------------------------------------------------------------------------- /usr/bin/update-everything: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | 3 | # update-everything v11 (February 25, 2025) 4 | # by Bruno "GNUser" Dantas, with special thanks to jazzbiker, Rich, Paul_123 5 | # GPLv3 6 | 7 | # Purpose: Do a full TCL system update as quickly and efficiently as possible. 8 | # Custom extensions (i.e., those that don't have a .md5.txt file) are left alone. 9 | # Usage: $ update-everything 10 | 11 | # note: /usr/local/bin is required so that openssl can be used for https mirrors. 12 | PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" 13 | export PATH 14 | 15 | main() 16 | { 17 | rm -rf "$TMPDIR"; mkdir "$TMPDIR"; cd "$TMPDIR" 18 | . /etc/init.d/tc-functions 19 | getMirror 20 | 21 | echo "Downloading and preparing databases..." 22 | download "$MD5DBGZ"; extract "$MD5DBGZ"; sanity_check_md5db 23 | download "$DEPDBGZ"; extract "$DEPDBGZ"; generate_depdir; sanity_check_depdir 24 | 25 | echo "Syncing .dep files..." 26 | fix_missing_and_extraneous_dep_files 27 | update_dep_files 28 | 29 | if $DEP_FILES_CHANGED; then 30 | echo "Stale .dep file(s) saved to /tmp/changed-depfiles" 31 | echo "Building package database..." 32 | tce-audit builddb 33 | echo "Looking for missing dependencies..." 34 | tce-audit fetchmissing 35 | fi 36 | 37 | remove_deprecated_extensions 38 | 39 | echo -n "Press Enter key to continue. " 40 | read junk 41 | 42 | echo "Updating extensions..." 43 | tce-update --skip-dependency-check 44 | 45 | rm -rf "$TMPDIR" 46 | exit 0 47 | } 48 | 49 | download() 50 | { 51 | if ! wget -q "$MIRROR/$1"; then 52 | echo "Download of $1 failed. Aborting." 53 | exit 1 54 | fi 55 | } 56 | 57 | extract() 58 | { 59 | if ! gunzip -kf "$1"; then 60 | echo "Error extracting $1. Aborting." 61 | exit 1 62 | fi 63 | } 64 | 65 | sanity_check_md5db() 66 | { 67 | if ! grep -q " zstd.tcz" "$MD5DB"; then 68 | echo "$MD5DB is missing or incomplete. Aborting." 69 | exit 1 70 | fi 71 | } 72 | 73 | generate_depdir() 74 | { 75 | mkdir "$DEPDIR" 76 | cp "$DEPDB" "$DEPDIR" 77 | awk -v DEPDIR="$DEPDIR" 'BEGIN {FS="\n";RS=""} { out=DEPDIR"/"$1".dep"; for (i=2; i<=NF; i++) printf("%s\n", $(i)) >out; close(out) }' "$DEPDB" 78 | } 79 | 80 | sanity_check_depdir() 81 | { 82 | if ! [ -f "$DEPDIR/zstd.tcz.dep" ]; then 83 | echo "$DEPDIR is missing or incomplete. Aborting." 84 | exit 1 85 | fi 86 | } 87 | 88 | fix_missing_and_extraneous_dep_files() 89 | { 90 | for md5file in $(find -L "$OPTIONALDIR" -name '*.md5.txt' -exec basename {} \;); do 91 | depfile="${md5file%.md5.txt}.dep" 92 | tczfile="${md5file%.md5.txt}" 93 | if [ -f "$DEPDIR/$depfile" ] && [ ! -f "$OPTIONALDIR/$depfile" ]; then 94 | echo "$depfile is missing, adding it..." 95 | cp "$DEPDIR/$depfile" "$OPTIONALDIR" 96 | DEP_FILES_CHANGED=true 97 | elif [ ! -f "$DEPDIR/$depfile" ] && [ -f "$OPTIONALDIR/$depfile" ] && grep -q " $tczfile" "$MD5DB"; then 98 | echo "$depfile is extraneous, removing it..." 99 | rm "$OPTIONALDIR/$depfile" 100 | fi 101 | done 102 | } 103 | 104 | update_dep_files() 105 | { 106 | rm -rf /tmp/changed-depfiles 107 | for md5file in $(find -L "$OPTIONALDIR" -name '*.md5.txt' -exec basename {} \;); do 108 | depfile="${md5file%.md5.txt}.dep" 109 | if [ ! -f "$OPTIONALDIR/$depfile" ] || [ ! -f "$DEPDIR/$depfile" ]; then # nothing to compare 110 | continue 111 | # echo is used in the comparison to eat whitespace (e.g., trailing spaces and blank lines): 112 | elif [ "$(echo $(cat "$OPTIONALDIR/$depfile"))" = "$(echo $(cat "$DEPDIR/$depfile"))" ]; then 113 | continue 114 | else 115 | echo "$depfile has changed, updating it..." 116 | mkdir -p /tmp/changed-depfiles 117 | cp "$OPTIONALDIR/$depfile" "/tmp/changed-depfiles/$depfile-old" 118 | cp "$DEPDIR/$depfile" "/tmp/changed-depfiles/$depfile-new" 119 | cp "$DEPDIR/$depfile" "$OPTIONALDIR" 120 | DEP_FILES_CHANGED=true 121 | fi 122 | done 123 | } 124 | 125 | remove_deprecated_extensions() 126 | { 127 | for md5file in $(find -L "$OPTIONALDIR" -name '*.md5.txt' -exec basename {} \;); do 128 | tczfile="${md5file%.md5.txt}" 129 | if ! grep -q "$tczfile" "$TMPDIR/$MD5DB"; then 130 | echo -n "$tczfile is deprecated (exists locally but not in repo). Remove it? [y/n] " 131 | read ans 132 | if ([ "$ans" = "y" ] || [ "$ans" = "Y" ]); then 133 | rm "$OPTIONALDIR/$tczfile"* 134 | fi 135 | fi 136 | done 137 | } 138 | 139 | # internal variables, do not touch: 140 | OPTIONALDIR="/etc/sysconfig/tcedir/optional" 141 | TMPDIR="/tmp/update-everything" 142 | DEPDIR="$TMPDIR/depfiles" 143 | DEPDB="dep.db" 144 | DEPDBGZ="$DEPDB.gz" 145 | MD5DB="md5.db" 146 | MD5DBGZ="$MD5DB.gz" 147 | DEP_FILES_CHANGED=false 148 | 149 | main 150 | -------------------------------------------------------------------------------- /usr/bin/tce-setup: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | #(c) Robert Shingledecker 2009-2011 3 | 4 | . /etc/init.d/tc-functions 5 | useBusybox 6 | checkroot 7 | 8 | read USER < /etc/sysconfig/tcuser 9 | TCEINSTALLED="/usr/local/tce.installed" 10 | 11 | process_normal_tcedir() { 12 | [ -z "$TCE" ] && TCE="$(tc_autoscan 'tce' 'd')"/tce 13 | if [ "$TCE" != "/tce" ]; then 14 | TCE_DEVICE="${TCE%%/*}" 15 | TCE_DIR="${TCE#*/}" 16 | if [ "$TCE_DEVICE" = "$TCE_DIR" ]; then TCE_DIR="tce"; fi 17 | find_mountpoint "$TCE_DEVICE" 18 | if [ -n "$MOUNTPOINT" ]; then 19 | if [ "$MOUNTED" == "yes" ]; then 20 | setupExtnDirs 21 | else 22 | mount "$MOUNTPOINT" 23 | if [ $? == 0 ]; then 24 | UMOUNT="yes" 25 | setupExtnDirs 26 | fi 27 | fi 28 | fi 29 | else 30 | MOUNTPOINT="/tmp"; TCE_DIR="tce" 31 | fi 32 | 33 | TCEDIR="$MOUNTPOINT"/"$TCE_DIR" 34 | if [ ! -d "$TCEDIR"/optional ]; then 35 | mkdir "$TCEDIR"/optional 36 | chown -R "$USER":staff "$TCEDIR" 37 | fi 38 | [ -L /etc/sysconfig/tcedir ] && rm -f /etc/sysconfig/tcedir 39 | ln -sf "$TCEDIR" /etc/sysconfig/tcedir 40 | chown -R "$USER":staff "$TCEINSTALLED" 41 | sync 42 | [ "$MOUNTPOINT" == "/tmp" ] && return 43 | 44 | # Process any .gzs in tce directory before regular extensions. 45 | if [ "$(ls -A "$TCEDIR"/*.gz 2>/dev/null)" ]; then 46 | process_gz "$TCEDIR" 47 | fi 48 | 49 | if [ -d "$TCEDIR"/optional/upgrade ] && [ "$(ls -A "$TCEDIR"/optional/upgrade 2>/dev/null)" ]; then 50 | echo -n "${GREEN}Performing upgrade from $TCEDIR/optional/upgrade. ${NORMAL}" 51 | yes y | cp -ai "$TCEDIR"/optional/upgrade/* "$TCEDIR"/optional/. 2>/dev/null && rm -rf "$TCEDIR"/optional/upgrade 52 | echo "${YELLOW}Done.${NORMAL}" 53 | fi 54 | # Process regular extensions 55 | ONBOOT="$TCEDIR"/"$TARGETLIST" 56 | [ -s "$ONBOOT" ] && process "$ONBOOT" 57 | sync 58 | } 59 | 60 | setupExtnDirs() { 61 | [ -d "$MOUNTPOINT"/"$TCE_DIR"/optional ] || mkdir -p "$MOUNTPOINT"/"$TCE_DIR"/optional 62 | [ -d "$MOUNTPOINT"/"$TCE_DIR"/ondemand ] || mkdir -p "$MOUNTPOINT"/"$TCE_DIR"/ondemand 63 | [ -f "$MOUNTPOINT"/"$TCE_DIR"/"$TARGETLIST" ] || touch "$MOUNTPOINT"/"$TCE_DIR"/"$TARGETLIST" 64 | chown -R "$USER":staff "$MOUNTPOINT"/"$TCE_DIR" 2>/dev/null 65 | chmod -R g+w "$MOUNTPOINT"/"$TCE_DIR" 2>/dev/null 66 | } 67 | 68 | process_gz() { 69 | FILELIST=`ls "$1"/*.gz` 70 | cd / 71 | for FILE in $FILELIST; do 72 | zcat "$FILE" | cpio -idmu > /dev/null 2>&1 73 | GZ="${FILE##*/}" 74 | STARTSCRIPT="$TCEINSTALLED"/"${GZ%.gz}" 75 | [ -s "$STARTSCRIPT" ] && sh "$STARTSCRIPT" 76 | done 77 | cd - > /dev/null 78 | setupHome 79 | } 80 | 81 | process() { 82 | [ -f "$1" ] && applist=$(awk -v ORS=" " '{gsub(/#.*/, ""); if ($1~/\w/) print $1;}' "$1") 83 | [ "$applist" ] && su "$USER" -c "tce-load -i -b -t `dirname $1` $applist" 84 | if [ -s /tmp/aberr ]; then 85 | echo "occured while loading: $applist" >> /tmp/aberr 86 | exit 1 87 | fi 88 | } 89 | 90 | process_CD() { 91 | CD="/mnt/${DEV#/dev/}" 92 | mount "$CD" 2>/dev/null 93 | if [ "$?" == 0 ] ; then 94 | if [ -d "$CD"/cde ]; then 95 | LOADFROM="$CD"/cde/optional 96 | CDELIST="$CD"/cde/"$TARGETLIST" 97 | if [ -s "$CDELIST" ]; then 98 | process "$CDELIST" 99 | echo "$LOADFROM" > /etc/sysconfig/cde 100 | fi 101 | else 102 | umount "$CD" 103 | fi 104 | fi 105 | } 106 | 107 | for i in `cat /proc/cmdline`; do 108 | case $i in 109 | tce=*) TCE=${i#*=} ;; 110 | lst=*) TARGETLIST=${i#*=} ;; 111 | esac 112 | case $i in 113 | cde) CDE=1 ;; 114 | base) ONLYBASE=1 ;; 115 | esac 116 | done 117 | 118 | [ -n "$TARGETLIST" ] || TARGETLIST="onboot.lst" 119 | 120 | # Process any .gzs before attempting to mount tce directory. 121 | # /tmp/builtin support provided for embedding extensions inside the initrd. 122 | if [ "$(ls -A "/tmp/builtin"/*.gz 2>/dev/null)" ]; then 123 | process_gz "/tmp/builtin" 124 | fi 125 | 126 | # Next Check for any tcz initrd builtins 127 | if [ -d /tmp/builtin ] && [ "$(ls -A /tmp/builtin 2>/dev/null)" ]; then 128 | TCEDIR=/tmp/builtin 129 | [ -s "$TCEDIR"/"$TARGETLIST" ] && process "$TCEDIR"/"$TARGETLIST" 130 | fi 131 | 132 | # Next process regular extensions unless BASE boot option has been specified. 133 | 134 | if [ "$1" == "booting" ] && [ -n "$ONLYBASE" ]; then 135 | echo "${GREEN}Skipping regular Extension loading as requested on the command line.${NORMAL}" 136 | TCEDIR="/tmp/tce" 137 | if [ ! -d "$TCEDIR"/optional ]; then 138 | mkdir "$TCEDIR"/optional 139 | chown -R "$USER":staff "$TCEDIR" 140 | fi 141 | else 142 | process_normal_tcedir 143 | fi 144 | 145 | # Finally check for CD Extensions if requested 146 | if [ "$CDE" ]; then 147 | # Some cd drives are slow - if cde was requested, wait for udev to settle 148 | [ ! -s /etc/sysconfig/cdroms ] && udevadm settle --timeout 5 149 | 150 | if [ -s /etc/sysconfig/cdroms ]; then 151 | for DEV in `cat /etc/sysconfig/cdroms`; do 152 | process_CD 153 | done 154 | fi 155 | fi 156 | 157 | # If nothing loaded then also check for pseudo CD, e.g., isohybrid 158 | if [ "$CDE" -a -z "$CDELIST" ]; then 159 | sleep 5 160 | DEV="$(tc_autoscan 'cde' 'd')" 161 | process_CD 162 | fi 163 | 164 | # Wrap up by performing updates as may be needed. 165 | if [ -e /etc/sysconfig/newmodules ]; then 166 | depmod -a 2>/dev/null 167 | /sbin/udevadm trigger 168 | fi 169 | /sbin/ldconfig 2>/dev/null 170 | if [ -s /tmp/setup.lst ]; then 171 | for F in `cat /tmp/setup.lst`; do "$F"; done 172 | rm -f /tmp/setup.lst 173 | fi 174 | 175 | [ -d /mnt/test ] && rmdir /mnt/test 176 | 177 | setupHome 178 | -------------------------------------------------------------------------------- /usr/bin/provides.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | . /etc/init.d/tc-functions 3 | useBusybox 4 | 5 | VERSION="Version 0.3 Nov 25, 2024" 6 | 7 | # ***** 8 | # Environmental variable PROVIDESUPDATE can override MMIN. 9 | # Add export PROVIDESUPDATE=+N to .profile file. 10 | # log out, log in. 11 | # N must be an integer. 12 | # Set to -0 to block updates. 13 | # Set to +0 for frequent updates. 14 | # Set to +N where N is the update interval in minutes. 15 | # Ex. PROVIDESUPDATE=+1440 for 24 hours. 16 | MMINoverride="$PROVIDESUPDATE" 17 | 18 | # Overide busybox awk with GNU awk. 19 | [ -e /usr/local/bin/awk ] && alias awk='/usr/local/bin/awk' 20 | 21 | TCEDIR="/etc/sysconfig/tcedir" 22 | DB="provides.db" 23 | LIST="$TCEDIR"/"$DB" 24 | 25 | # Search for exact match. 0=No 1=Yes. 26 | Exact=0 27 | 28 | # Run zsync on provides.db file. 0=No 1=Yes. 29 | NZ=1 30 | 31 | # Show full paths. 0=No 1=Yes 32 | FullPaths=0 33 | 34 | # Maximum age of provides.db in minutes before checking for update. 35 | MMIN=+15 36 | 37 | # This will contain the search term. 38 | TARGET="" 39 | 40 | # --------------------------------------------------------------- # 41 | # Checks first char is + or -. 42 | # Checks remaining chars are digits. 43 | IsSignedInteger() 44 | { 45 | local __NUM=$1 46 | 47 | # Must be at least 2 chars long. + or - followed by a digit. 48 | [ ${#__NUM} -lt 2 ] && echo "" && return 49 | 50 | # Test to make sure first char is a + or -. 51 | [ ${__NUM:0:1} != "-" ] && [ ${__NUM:0:1} != "+" ] && echo "" && return 52 | 53 | # We know the first char. So deleting all digits should leave that char. 54 | [ ${__NUM//[0-9]/} != "-" ] && [ ${__NUM//[0-9]/} != "+" ] && echo "" && return 55 | 56 | # Valid signed integer. 57 | echo "$__NUM" 58 | } 59 | # --------------------------------------------------------------- # 60 | 61 | # --------------------------------------------------------------- # 62 | # Parse search term to escape troublesome chars. 63 | SanitizeTarget() 64 | { 65 | # Remove all backslashes. 66 | TARGET="${TARGET//\\}" 67 | 68 | # Add \ to any of the found chars. 69 | for Char in '/' '+' '$' '[' ']' '(' ')' '^' 70 | do 71 | TARGET="${TARGET//$Char/\\$Char}" 72 | done 73 | } 74 | # --------------------------------------------------------------- # 75 | 76 | # --------------------------------------------------------------- # 77 | # Remove command line switch __SW from TARGET. 78 | StripTarget() 79 | { 80 | local __SW=$1 81 | # Strip out __SW parameter if present. 82 | # Mingled with other switches (leading and trailing spaces). 83 | TARGET="${TARGET// $__SW / }" 84 | # From beginning of parameters (trailing space only). 85 | TARGET="${TARGET#$__SW }" 86 | # From end of parameters (leading space only). 87 | TARGET="${TARGET% $__SW}" 88 | # No search term specified (no leading or trailing spacea). 89 | [ "$TARGET" == "$__SW" ] && TARGET="" 90 | } 91 | # --------------------------------------------------------------- # 92 | 93 | # --------------------------------------------------------------- # 94 | UpdateProvidesDB() 95 | { 96 | 97 | # Check if MMINoverride is set and a signed integer. 98 | MMINoverride=$(IsSignedInteger $MMINoverride) 99 | 100 | # If it's valid, set MMIN. 101 | [ -n "$MMINoverride" ] && MMIN="$MMINoverride" 102 | 103 | # Check if the provides.db is old enough to warrant a zsync. 104 | [ -f "$LIST" ] && [ -z "$(find $LIST -mmin $MMIN)" ] && return 0 105 | 106 | # No point in going further if no network connectivity. 107 | /bin/ping -A -W 1 -c 2 8.8.8.8 2>&1 > /dev/null || return 108 | 109 | getMirror 110 | 111 | # zsync only works with http 112 | [ "$MIRRORPROTO" == "http" ] && [ -n "`which zsync`" ] && USEZSYNC=yes 113 | 114 | cd "$TCEDIR" 115 | if [ -n "$USEZSYNC" ] && zsync -i "$LIST" -q "$MIRROR"/"$DB".zsync; then 116 | rm -f "$DB".zs-old 117 | else 118 | # always update if not http or zsync failed 119 | rm -f "$LIST" 120 | wget -O "$LIST".gz "$MIRROR"/"$DB".gz 121 | gunzip "$LIST".gz 122 | fi 123 | chmod g+rw "$DB" 124 | touch "$DB" 125 | cd - > /dev/null 126 | } 127 | # --------------------------------------------------------------- # 128 | 129 | # --------------------------------------------------------------- # 130 | Usage() 131 | { 132 | # Suppress help message if stdout is redirected. 133 | [ ! -t 1 ] && exit 1 134 | 135 | echo " 136 | $VERSION 137 | 138 | Find extension(s) that provide a filename. 139 | Filenames in list being searched include full paths, for example: 140 | usr/local/bin/grep 141 | 142 | Usage: 143 | ${0##*/} [ -nz ] [ -f ] FileName 144 | 145 | -nz Skip updating (zsync) the provides.db file. This speeds up 146 | the search, but might miss items if provides.db is outdated. 147 | 148 | -f Show the full paths as well as the extension name 149 | 150 | Examples: 151 | ${0##*/} cal Finds cal anywhere in FileName 152 | ${0##*/} bin/cal Finds bin/cal anywhere in FileName 153 | ${0##*/} bin/cal$ Finds FileName that ends in bin/cal 154 | ${0##*/} Black Gnome Finds FileName with embedded spaces 155 | 156 | Searches are case sensitive. 157 | The $ sign can only be used at the end of your search term. 158 | " 159 | exit 160 | } 161 | # --------------------------------------------------------------- # 162 | 163 | TARGET=$@ 164 | SanitizeTarget 165 | 166 | # Read parameters. 167 | for ARG in $TARGET 168 | do 169 | case "$ARG" in 170 | -h|-help|--help) Usage;; 171 | -nz) NZ=0;; 172 | -f) FullPaths=1;; 173 | *) continue;; 174 | esac 175 | done 176 | 177 | # Remove all command line switches from search term. 178 | for OPT in "-nz" "-f" 179 | do 180 | StripTarget "$OPT" 181 | StripTarget "$OPT" 182 | done 183 | 184 | # Strip any remaining leading and trailing spaces. 185 | TARGET="$(echo $TARGET)" 186 | 187 | # Run zsync on the provides.db file if NZ equals 1. 188 | [ $NZ -eq 1 ] && UpdateProvidesDB 189 | 190 | # Save string length of TARGET. 191 | Length=${#TARGET} 192 | 193 | # Remove trailing \$ (exact match request) if present. 194 | TARGET="${TARGET%\\\$}" 195 | 196 | # If TARGET is shorter, exact match was requested. 197 | [ ${#TARGET} -lt $Length ] && Exact=1 198 | 199 | # Test if search term is missing. 200 | [ -z "$TARGET" ] && Usage 201 | 202 | if [ $FullPaths -eq 0 ] 203 | then 204 | if [ $Exact -eq 0 ] 205 | then 206 | awk 'BEGIN {FS="\n";RS=""} /'"${TARGET}"'/{print $1}' "$LIST" 207 | else 208 | awk 'BEGIN {FS="\n";RS=""} /'"${TARGET}"'\n/||/'"${TARGET}"'$/{print $1}' "$LIST" 209 | fi 210 | else 211 | # print them out as 'extension.tcz : /path/to/file' 212 | if [ $Exact -eq 0 ] 213 | then 214 | awk 'BEGIN {FS="\n";RS=""} /'"${TARGET}"'/{i=2;while(i<=NF){if($i~/'"${TARGET}"'/)printf"%-30s : %s\n",$1,$i;i++;}}' "$LIST" 215 | else 216 | awk 'BEGIN {FS="\n";RS=""} /'"${TARGET}"'/{i=2;while(i<=NF){if($i~/'"${TARGET}"'$/)printf"%-30s : %s\n",$1,$i;i++;}}' "$LIST" 217 | fi 218 | fi 219 | -------------------------------------------------------------------------------- /usr/bin/tce-audit: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2009, 2010 3 | . /etc/init.d/tc-functions 4 | useBusybox 5 | getMirror 6 | KERNELVER=$(uname -r) 7 | TCE_DB="tce.db" 8 | TCE_LST="tce.lst" 9 | AUDIT_RESULTS="/tmp/audit_results.txt" 10 | AUDIT_WORK="/tmp/audit_work.txt" 11 | AUDIT_MARKED="/tmp/audit_marked.lst" 12 | DEFAULT_DIR=/etc/sysconfig/tcedir/optional 13 | ACTION="$1" 14 | ARG2="$2" 15 | 16 | abort(){ 17 | echo "Usage: tce-audit { updatedeps | builddb | auditall | fetchmissing | nodepends | notrequired | marked | clearlst | md5check } /path/to/tcedir/" 18 | echo " tce-audit { dependson | requiredby | audit | delete } /path/to/tcedir/extension.tcz" 19 | echo " tce-audit { remove }" 20 | exit 1 21 | } 22 | 23 | [ -z ${ACTION} ] && abort 24 | 25 | if [ "${ARG2:0:1}" == "/" ] && [ -d ${ARG2} ]; then 26 | TCEDIR=${ARG2} 27 | [ -z ${TCEDIR} ] && TCEDIR=${DEFAULT_DIR} 28 | [ -d ${TCEDIR} ] || abort 29 | EXTNAME="" 30 | else 31 | TCEDIR=${TCEDIR%/*} 32 | [ -z ${TCEDIR##/*/} ] && TCEDIR=${DEFAULT_DIR} 33 | [ -d ${TCEDIR} ] || abort 34 | EXTNAME=${ARG2##/*/} 35 | [ ${EXTNAME%%.tcz} == ${EXTNAME} ] && EXTNAME=${EXTNAME}.tcz 36 | EXTNAME="${EXTNAME/-KERNEL/-${KERNELVER}}" 37 | fi 38 | 39 | updatedeps(){ 40 | echo -n "Updating .dep files from " 41 | echo "$TCEDIR" 42 | ls *.tcz | while read F 43 | do 44 | TARGET=${F##/*/}.dep 45 | TARGET="${TARGET/-KERNEL/-${KERNELVER}}" 46 | echo -n "." 47 | [ -f /tmp/"$TARGET" ] && rm -f /tmp/"$TARGET" 48 | wget -cq -P /tmp "$MIRROR"/"$TARGET" 2>/tmp/fetch_result 49 | if [ "$?" == 0 ]; then 50 | mv /tmp/"$TARGET" "$TCEDIR"/. 51 | else 52 | if grep -v 404 /tmp/fetch_result; then 53 | echo "$?" >> "$AUDIT_RESULTS" 54 | echo "Error on downloading of $F" >> "$AUDIT_RESULTS" 55 | echo "Could be a network issue or ..." >> "$AUDIT_RESULTS" 56 | echo "that this extension has a new name or is no longer supported!" >> "$AUDIT_RESULTS" 57 | fi 58 | fi 59 | done 60 | echo 61 | [ -s "$AUDIT_RESULTS" ] && echo "Errors occurred during audit. See /tmp/audit_results.txt" 62 | } 63 | 64 | builddb(){ 65 | > "$AUDIT_RESULTS" 66 | > "$TCE_DB" 67 | > "$TCE_LST" 68 | echo -n "Building Extension Database from " 69 | echo "$TCEDIR" 70 | ls *.tcz 2>/dev/null | sed 's/.*\///' | awk -v tce_lst="$TCE_LST" -v tce_db="$TCE_DB" ' 71 | function recursive_scan(name, optional, _, depfile, line, i, x) { 72 | gsub(/[\t ]+/, "", name) 73 | if (name) { 74 | sub(/\-KERNEL\.tcz/, "-"KERNELVER".tcz", name) 75 | if (name in MARK) { 76 | if (MARK[name] == 2) { 77 | RESULT[++IDX] = name 78 | for (x in MARK) { 79 | if (MARK[x] == 2) { 80 | LOOP[x] = name 81 | if (DEPTH[x] >= DEPTH[name]) 82 | LOOPITEM[name] = LOOPITEM[name]"\n"x 83 | } 84 | } 85 | } else { 86 | RESULT[++IDX] = "@#"name 87 | } 88 | } else { 89 | RESULT[++IDX] = name 90 | IRANGE[name"#1"] = IDX 91 | MARK[name] = 2 92 | DEPTH[name] = ++DEPTHNUM 93 | if (system("test -f "optional"/"name) == 0) { 94 | depfile=optional"/"name".dep" 95 | while (getline line < depfile > 0) 96 | recursive_scan(line, optional) 97 | close(depfile) 98 | } 99 | MARK[name] = 1 100 | DEPTHNUM -- 101 | IRANGE[name"#2"] = IDX 102 | } 103 | } 104 | } 105 | function output(idx1, idx2, _, name, i, refname) { 106 | for (i=idx1; i<=idx2; i++) { 107 | name=RESULT[i] 108 | if (! (name in PRINTED)) { 109 | PRINTED[name]=1 110 | if (substr(name, 1, 2) == "@#") { 111 | refname = substr(name, 3) 112 | output(IRANGE[refname"#1"], IRANGE[refname"#2"]+0) 113 | } else { 114 | print name >> tce_db 115 | } 116 | } 117 | } 118 | } 119 | BEGIN {KERNELVER="'"$KERNELVER"'"; IDX=0; DEPTHNUM=0;} 120 | {recursive_scan($1, substr($2, 1, 1)=="/" ? $2 : ENVIRON["PWD"]); if (NR%5==0) printf ".";} 121 | END { 122 | for (name in MARK) 123 | system("test -f " name " && echo " name " >> " tce_lst) 124 | close(tce_lst) 125 | system("busybox sort -f "tce_lst" > /tmp/sort.$$ && mv /tmp/sort.$$ "tce_lst" 2>/dev/null") 126 | while (getline name < tce_lst > 0) { 127 | output(IRANGE[name"#1"], IRANGE[name"#2"]+0) 128 | delete PRINTED 129 | if (name in LOOP) 130 | print "Warning loop dependencies:"LOOPITEM[LOOP[name]] >> tce_db 131 | print "" >> tce_db 132 | } 133 | }' 134 | echo 135 | } 136 | 137 | dependson() { 138 | awk -v target="$1" -v results="$AUDIT_RESULTS" ' 139 | BEGIN { 140 | FS="\n" 141 | RS="" 142 | print "Has the following dependencies:" > results 143 | } 144 | { 145 | if ($1 == target) 146 | for (i=2; i <= NF; i=i+1 ) 147 | print $i >> results 148 | } ' < "$TCE_DB" 149 | } 150 | 151 | nodepends() { 152 | awk -v results="$AUDIT_RESULTS" ' 153 | BEGIN { 154 | FS="\n" 155 | RS="" 156 | print "The following extensions have no dependencies:" > results 157 | } 158 | { 159 | if (NF == 1) 160 | print $1 > results 161 | } ' < "$TCE_DB" 162 | } 163 | 164 | notrequired() { 165 | echo "The following are NOT required by any other extensions:" > "$AUDIT_WORK" 166 | while read F; do 167 | > "$AUDIT_RESULTS" 168 | requiredby "$F" 169 | [ -s "$AUDIT_RESULTS" ] || echo "$F" >> "$AUDIT_WORK" 170 | done < "$TCE_LST" 171 | mv "$AUDIT_WORK" "$AUDIT_RESULTS" 172 | } 173 | 174 | requiredby() { 175 | awk -v target="$1" -v results="$AUDIT_RESULTS" ' 176 | BEGIN { 177 | FS="\n" 178 | RS="" 179 | } 180 | { 181 | for (i=2; i <= NF; i=i+1 ) 182 | if ($i == target) print $1 > results 183 | } ' < "$TCE_DB" 184 | } 185 | 186 | auditall() { 187 | > "$AUDIT_RESULTS" 188 | while read F; do 189 | audit "$F" 190 | done < "$TCE_LST" 191 | } 192 | 193 | fetchmissing() { 194 | auditall 195 | for F in $(awk '{print $3}' $AUDIT_RESULTS | sort | uniq); do 196 | tce-load -wl "$F" 2>/dev/null 197 | done 198 | > "$AUDIT_RESULTS" 199 | } 200 | 201 | audit() { 202 | awk -v target="$1" -v list="$TCE_LST" -v results="$AUDIT_RESULTS" ' 203 | BEGIN { 204 | FS="\n" 205 | RS="" 206 | } 207 | { 208 | if ($1 == target) { 209 | for ( i = 2; i <= NF; i++ ) { 210 | result = system("grep -w ^"$i"$ "list" >/dev/null 2>&1") 211 | if (result == 1) 212 | print "For " target " " $i" is missing!" >> results 213 | } 214 | } 215 | } ' < "$TCE_DB" 216 | } 217 | 218 | md5check() { 219 | ERRORS=0 220 | for md5file in *.md5.txt; do 221 | md5sum -cs $md5file || { echo "FAIL: $md5file"; ERRORS=1; } 222 | done 223 | 224 | if [ $ERRORS -eq 0 ]; then 225 | echo "OK: all md5sums are correct" 226 | exit 0 227 | else 228 | exit 1 229 | fi 230 | } 231 | 232 | #main 233 | cd "$TCEDIR" 234 | > "$AUDIT_RESULTS" 235 | 236 | case $1 in 237 | updatedeps) updatedeps 238 | builddb 239 | ;; 240 | builddb) builddb 241 | ;; 242 | dependson) dependson "$EXTNAME" 243 | ;; 244 | nodepends) nodepends 245 | ;; 246 | notrequired) notrequired 247 | ;; 248 | requiredby) requiredby "$EXTNAME" 249 | ;; 250 | auditall) auditall 251 | ;; 252 | fetchmissing) fetchmissing 253 | ;; 254 | audit) audit "$EXTNAME" "report" 255 | ;; 256 | delete) 257 | requiredby "$EXTNAME" 258 | if [ -s "$AUDIT_MARKED" ]; then 259 | for M in `cat "$AUDIT_MARKED"`; do 260 | sed -i '/'`basename "$M"`'/d' "$AUDIT_RESULTS" 261 | done 262 | fi 263 | if [ -s "$AUDIT_RESULTS" ]; then 264 | echo "$EXTNAME" "cannot be deleted." >> "$AUDIT_RESULTS" 265 | else 266 | awk 'BEGIN { FS="\n"; RS="" }/^'"$EXTNAME"'/' "$TCE_DB" > /tmp/audit_work.$$ 267 | if [ -s /tmp/audit_work.$$ ]; then 268 | cp /tmp/audit_work.$$ /tmp/audit_work2.$$ 269 | [ -s "$AUDIT_MARKED" ] && while read M; do echo ${M##*/} >> /tmp/audit_work2.$$; done < "$AUDIT_MARKED" 270 | for D in `cat /tmp/audit_work.$$`; do 271 | > "$AUDIT_RESULTS" 272 | requiredby "$D" 273 | RESULTS=` grep -vf /tmp/audit_work2.$$ "$AUDIT_RESULTS"` 274 | if [ "$RESULTS" = "" ]; then 275 | grep -q "$D" "$AUDIT_MARKED" 2>/dev/null || echo "$TCEDIR"/"$D" >> "$AUDIT_MARKED" 276 | grep -q "$D" /tmp/audit_results.$$ 2>/dev/null || echo "$TCEDIR"/"$D" >> /tmp/audit_results.$$ 277 | fi 278 | done 279 | rm /tmp/audit_work.$$ /tmp/audit_work2.$$ 280 | mv /tmp/audit_results.$$ "$AUDIT_RESULTS" 281 | fi 282 | fi 283 | ;; 284 | marked) if [ -s "$AUDIT_MARKED" ]; then 285 | sort "$AUDIT_MARKED" | uniq | tee /tmp/audit_results.$$ 286 | mv /tmp/audit_results.$$ "$AUDIT_MARKED" 287 | fi 288 | ;; 289 | clearlst) > "$AUDIT_MARKED" 290 | ;; 291 | remove) tce-remove 292 | exit 0 293 | ;; 294 | md5check) md5check 295 | ;; 296 | *) abort 297 | ;; 298 | esac 299 | if [ -s "$AUDIT_RESULTS" ]; then cat "$AUDIT_RESULTS"; fi 300 | -------------------------------------------------------------------------------- /usr/bin/tce-update: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2009 3 | # zsync mods by Curaga 2010 4 | 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | 8 | KERNELVER=$(uname -r) 9 | getMirror 10 | 11 | # zsync only works with http 12 | [ "$MIRRORPROTO" == "http" ] && [ -n "`which zsync`" ] && USEZSYNC=yes 13 | 14 | dep_vars(){ 15 | sed -i "s@KERNEL@$KERNELVER@" $1 16 | } 17 | 18 | fetch(){ 19 | [ -f "$1" ] && rm -f "$1" 20 | wget -cq "$MIRROR"/"$1" 21 | } 22 | fetchzsync(){ 23 | [ -f "$1" ] && rm -f "$1" 24 | if zsync -i "$UPGRADE_DIR"/"$1" -q "$MIRROR"/"$1".zsync; then 25 | rm -f "$1".zs-old 26 | else 27 | wget -cq "$MIRROR"/"$1" # Either there was no zsync file on the server, or it failed 28 | fi 29 | } 30 | 31 | chkMd5Only(){ 32 | MYMD5=`cat "$F"` 33 | TARGET="$(getbasefile "$F" 2)" 34 | REPO=`grep -w " $TARGET" md5.db` 35 | if [ -n "$REPO" ]; then 36 | [ "$MYMD5" == "$REPO" ] || echo $(basename "${F%.md5.txt}") 37 | else 38 | echo "Error Could not verify $TARGET" | tee -a "$ERRLIST" 39 | fi 40 | } 41 | 42 | upgrade(){ 43 | TARGET="$(getbasefile "$F" 2)" 44 | REPO=`grep -w " $TARGET" md5.db` 45 | if [ -n "$REPO" ]; then 46 | MYMD5=`cat "$F"` 47 | if [ "$MYMD5" != "$REPO" ]; then 48 | if [ "$QUERY" ]; then 49 | echo -n " ${YELLOW}$TARGET${NORMAL}" 50 | else 51 | echo -n "Updating $TARGET " 52 | if [ -n "$USEZSYNC" ]; then 53 | fetchzsync "$TARGET" 2>/dev/null 54 | else 55 | fetch "$TARGET" 2>/dev/null 56 | fi 57 | echo "$REPO" > "$TARGET".md5.txt 58 | md5sum -cs "$TARGET".md5.txt 59 | if [ "$?" == 0 ]; then 60 | fetch "$TARGET".dep 2>/dev/null 61 | if [ "$?" == 0 ]; then 62 | dep_vars /tmp/"$TARGET".dep 63 | mv /tmp/"$TARGET".dep "$TARGET_DIR"/. 64 | fi 65 | mv /tmp/"$TARGET".md5.txt "$TARGET_DIR"/. 2>/dev/null 66 | mv /tmp/"$TARGET" "$TARGET_DIR"/. 2>/dev/null 67 | UPDATED_APPS=1 68 | echo "OK" 69 | else 70 | echo "Failed" 71 | echo "Error occurred. $TARGET Not updated!" >> "$ERRLIST" 72 | rm /tmp/"$TARGET".md5.txt 73 | rm /tmp/"$TARGET" 74 | fi 75 | fi 76 | fi 77 | else 78 | echo >> "$ERRLIST" 79 | echo "Error Could not verify $TARGET" | tee -a "$ERRLIST" 80 | fi 81 | } 82 | 83 | 84 | check_dependencies(){ 85 | [ -n "$SKIPDEPCHECK" ] && return 86 | # echo "${BLUE}Checking dependencies:${NORMAL}" 87 | DEPS="$(/bin/busybox find -L "$UPGRADE_DIR" -regex '.*\.tcz\.dep$' | sort)" 88 | [ -f $TCEDIR/tcz-black.lst ] && DEPS=$(echo $DEPS | grep -v -f $TCEDIR/tcz-black.lst) 89 | for F in $DEPS; do 90 | for TARGET in `cat "$F"`; do 91 | if [ ! -f "$UPGRADE_DIR"/"$TARGET" ] && [ ! -f "$UPGRADE_DIR"/upgrade/"$TARGET" ]; then 92 | REPO=`grep -w "$TARGET" md5.db` 93 | if [ -n "$REPO" ]; then 94 | echo -n "Fetching required dependency: $TARGET " 95 | if [ -n "$USEZSYNC" ]; then 96 | fetchzsync "$TARGET" 2>/dev/null 97 | else 98 | fetch "$TARGET" 2>/dev/null 99 | fi 100 | echo "$REPO" > "$TARGET".md5.txt 101 | md5sum -cs "$TARGET".md5.txt 102 | if [ "$?" == 0 ]; then 103 | mv /tmp/"$TARGET".md5.txt "$TARGET_DIR"/. 2>/dev/null 104 | mv /tmp/"$TARGET" "$TARGET_DIR"/. 2>/dev/null 105 | UPDATED_APPS=1 106 | echo "OK" 107 | else 108 | echo "Failed" 109 | echo "Error occurred while fetching dependency: $TARGET" >> "$ERRLIST" 110 | rm /tmp/"$TARGET".md5.txt 111 | rm /tmp/"$TARGET" 112 | fi 113 | fi 114 | fi 115 | done 116 | done 117 | } 118 | 119 | check_bootoptions(){ 120 | for i in `cat /proc/cmdline`; do 121 | case $i in 122 | *=*) 123 | case $i in 124 | tce*) TCE=${i#*=} ;; 125 | esac 126 | ;; 127 | *) 128 | case $i in 129 | base) BASE=1 ;; 130 | norestore) NORESTORE=1 ;; 131 | esac 132 | ;; 133 | esac 134 | done 135 | [ "$BASE" ] || MISSING="base" 136 | [ "$NORESTORE" ] || MISSING="$MISSING norestore" 137 | if [ -n "$MISSING" ]; then 138 | echo "${GREEN}To ensure a safe batch upgrade of all extensions," 139 | echo "the following boot codes are recommended:" 140 | echo "${YELLOW}base norestore text${NORMAL}" 141 | echo 142 | echo "${GREEN}Best to run when no other extensions are being used.${NORMAL}" 143 | echo 144 | echo "${YELLOW}The following boot codes are missing:" 145 | echo "${RED}$MISSING${NORMAL}" 146 | echo 147 | echo "${BLUE}It is recommended to Reboot with the recommended boot options," 148 | echo "and at system prompt enter:${YELLOW} sudo tce-update" 149 | echo 150 | echo "${GREEN}At minimum it better to exit from X and at system prompt enter:" 151 | echo "${YELLOW}sudo tce-update" 152 | echo 153 | echo "${YELLOW}To ignore recommendatons and force an update, type ${RED}force${YELLOW}, then press Enter" 154 | echo 155 | echo "${BLUE}To query which extensions need to be updated, type ${YELLOW}query${BLUE}, then press Enter" 156 | echo 157 | echo -n "${GREEN}Otherwise press Enter key to exit: ${NORMAL}";read answer 158 | case $answer in 159 | force) ;; 160 | query) QUERY=1 ;; 161 | *) exit 1 162 | esac 163 | fi 164 | } 165 | 166 | process_dir(){ 167 | if [ ! "$LIST" ]; then 168 | echo -n "${BLUE}Checking Tiny Core Applications in ${YELLOW}" 169 | echo "$UPGRADE_DIR${NORMAL}" 170 | [ "$QUERY" ] && echo "${BLUE}The following extensions need to be updated!${NORMAL}" 171 | fi 172 | FILES="$(/bin/busybox find -L "$UPGRADE_DIR" -regex '.*\.tcz\.md5\.txt$' | sort)" 173 | [ -f $TCEDIR/tcz-black.lst ] && FILES="$(echo "$FILES" | grep -v -f $TCEDIR/tcz-black.lst)" 174 | for F in $FILES; do 175 | if [ "$LIST" ]; then 176 | chkMd5Only 177 | else 178 | upgrade 179 | fi 180 | done 181 | } 182 | 183 | process_cmd(){ 184 | TARGET="$1" 185 | if [ "$QUERY" ] || [ "$LIST" ]; then 186 | [ -z "${TARGET##*/}" ] || TARGET="$TARGET"/ 187 | TARGET_DIR=${TARGET%/*} 188 | [ -d "$TARGET_DIR" ] || exit 1 # Need at least a dir 189 | UPGRADE_DIR="$TARGET_DIR" 190 | process_dir 191 | else 192 | if [ -f "$TARGET" ]; then 193 | TARGET_DIR=${TARGET%/*} 194 | [ -d "$TARGET_DIR"/upgrade ] || mkdir "$TARGET_DIR"/upgrade 195 | F="$TARGET" 196 | [ "${F%.md5.txt}" == "$F" ] && F="$F".md5.txt 197 | UPGRADE_DIR="$TARGET_DIR" 198 | TARGET_DIR="$TARGET_DIR"/upgrade 199 | upgrade 200 | check_dependencies 201 | fi 202 | fi 203 | exit 0 204 | } 205 | 206 | # Main 207 | if [ "$1" = "--skip-dependency-check" ]; then 208 | SKIPDEPCHECK=1 209 | shift 210 | fi 211 | cd /tmp 212 | ERRLIST="upgrade_errors.lst" 213 | > "$ERRLIST" 214 | UPDATED_APPS=0 215 | [ -e md5.db ] && rm -f md5.db 216 | tce-fetch.sh md5.db.gz 217 | if [ "$?" != 0 ]; then 218 | echo "Could not fetch md5 database." | tee -a "$ERRLIST" 219 | exit 1 220 | fi 221 | gzip -d md5.db.gz 222 | 223 | # First test for interactive mode - passed parameters 224 | if [ -n "$1" ]; then 225 | case $1 in 226 | list) LIST=1; process_cmd "${2:-$(readlink /etc/sysconfig/tcedir)}" ;; 227 | query) QUERY=1; process_cmd "${2:-$(readlink /etc/sysconfig/tcedir)}" ;; 228 | update) unset QUERY; process_cmd "$2" ;; 229 | esac 230 | fi 231 | 232 | # If not interactive then check for easy mode or inplace batch update 233 | clear 234 | echo -n "${YELLOW}Checking for Easy Mode Operation... ${NORMAL}" 235 | [ -z "$TCE" ] && TCE="$1" 236 | [ -z "$TCE" ] && TCE=`readlink /etc/sysconfig/tcedir` 237 | [ "$TCE" == "/tmp/tce/" ] && TCE="" 238 | TCE="${TCE#/mnt/}" 239 | # Next search for tce 240 | [ -z "$TCE" ] && TCE="$(tc_autoscan 'tce' 'd')"/tce 241 | TCE_DEVICE="${TCE%%/*}" 242 | TCE_DIR="${TCE#*/}" 243 | TCEDIR=/mnt/"$TCE_DEVICE"/"$TCE_DIR" 244 | if [ "$TCE_DEVICE" != "nfs" ] ; then 245 | mount /mnt/"$TCE_DEVICE" 2> /dev/null 246 | if [ "$?" == 1 ]; then 247 | echo 248 | echo "${RED}Could not find a valid tce directory!${NORMAL}" 249 | exit 1 250 | fi 251 | USED_SPACE=`du -sk "$TCEDIR" | awk '{print $1}'` 252 | FREE_SPACE=`df /dev/"$TCE_DEVICE" | awk '/'"$TCE_DEVICE"'/{ print $4}'` 253 | NEED_SPACE=`expr "$USED_SPACE" \* 2` 254 | EASY_MODE=`expr $NEED_SPACE \< "$FREE_SPACE"` 255 | else 256 | EASY_MODE=1 257 | fi 258 | 259 | if [ "$EASY_MODE" == 1 ]; then 260 | echo "${GREEN}OK" 261 | echo 262 | echo "${GREEN}Press ${YELLOW}Enter${GREEN} key to begin batch update of extensions in /${TCE}" 263 | echo -n "or enter any char to exit now: ${NORMAL}";read ANS 264 | [ -z "$ANS" ] || exit 1 265 | UPGRADE_DIR="$TCEDIR" 266 | else 267 | echo; echo 268 | echo "${YELLOW}Unfortunately there is not enough free disk space for easy mode." 269 | echo "${BLUE}You can still proceed with in-place extension update.i${NORMAL}" 270 | echo 271 | UPGRADE_DIR="$TCEDIR" 272 | check_bootoptions 273 | fi 274 | 275 | cd /tmp 276 | 277 | if [ -d "$UPGRADE_DIR"/optional ]; then 278 | UPGRADE_DIR="$UPGRADE_DIR"/optional 279 | if [ "$EASY_MODE" == 1 ]; then 280 | TARGET_DIR="$UPGRADE_DIR"/upgrade 281 | else 282 | TARGET_DIR="$UPGRADE_DIR" 283 | fi 284 | [ -d "$TARGET_DIR" ] || mkdir "$TARGET_DIR" 285 | process_dir 286 | check_dependencies 287 | fi 288 | 289 | if [ -s "$ERRLIST" ]; then 290 | echo -n "${RED}Errors occurred during upgrade. Press Enter to see /tmp/upgrade_errors.lst${NORMAL}"; read junk 291 | less /tmp/upgrade_errors.lst 292 | fi 293 | if [ ! "$QUERY" ]; then 294 | if [ $UPDATED_APPS == 1 ]; then 295 | echo "${GREEN}Reboot to use new updated extensions!${NORMAL}" 296 | else 297 | echo "${GREEN}Your system is up-to-date.${NORMAL}" 298 | fi 299 | fi 300 | echo -n "Press Enter key. ";read junk 301 | -------------------------------------------------------------------------------- /usr/bin/tce-load: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # (c) Robert Shingledecker 2004-2010 3 | # tcz concept and code from Jason Williams 4 | # 5 | . /etc/init.d/tc-functions 6 | useBusybox 7 | checknotroot 8 | PROG_NAME=$(basename $0) 9 | KERNELVER=$(uname -r) 10 | unset WGET INSTALL COPYINSTALL BOOTING ONDEMAND DOWNLOAD_ONLY LOAD_ONLY SUPPRESS 11 | FORCE="n" # Overwrite system files default to no. Use -f to force overwrite. 12 | SAVED_DIR=`pwd` 13 | 14 | ONBOOTNAME="$(getbootparam lst 2>/dev/null)" 15 | [ -n "$ONBOOTNAME" ] || ONBOOTNAME="onboot.lst" 16 | TCEINSTALLED=/usr/local/tce.installed 17 | TCEDIR=/etc/sysconfig/tcedir 18 | 19 | abort(){ 20 | echo "Version `version`"; 21 | echo "Usage: ${PROG_NAME} [ -i -w -wi -wo -wil -ic -wic -wicl]{s} extensions" 22 | echo " -i Loads local extension" 23 | echo " -w Download extension only" 24 | echo " -wi Download and install extension" 25 | echo " -wo Download and create an ondemand item" 26 | echo " Adding -c to any -i option will force a one time copy to file system" 27 | echo " Adding -l to any -i option indicates load only - do not update onboot or ondemand" 28 | echo " Adding -s to any option will suppress OK message used by apps GUI" 29 | echo -e "\nExample usage:" 30 | echo " Load local extension:" 31 | echo " tce-load -i /mnt/hda1/tce/optional/nano.tcz" 32 | echo " Download into tce/optional directory, updates OnBoot and installs:" 33 | echo " tce-load -w -i nano.tcz" 34 | echo " Download only into tce/optional directory:" 35 | echo " tce-load -w nano.tcz" 36 | exit 2 37 | } 38 | 39 | abort_to_saved_dir(){ 40 | echo "1" > /tmp/appserr 41 | if [ "$BOOTING" ]; then 42 | SKIP=TRUE 43 | else 44 | #cd "$SAVED_DIR" 45 | exit 1 46 | fi 47 | } 48 | 49 | while getopts wilcbosft: OPTION 50 | do 51 | case ${OPTION} in 52 | w) WGET=TRUE ;; 53 | i) INSTALL=TRUE ;; 54 | l) LOAD_ONLY=TRUE ;; 55 | c) COPYINSTALL=TRUE ;; 56 | b) BOOTING=TRUE ;; 57 | o) ONDEMAND=TRUE ;; 58 | s) SUPPRESS=TRUE ;; 59 | f) FORCE="y" ;; 60 | t) TCEDIR="$OPTARG" ;; 61 | *) abort ;; 62 | esac 63 | done 64 | shift `expr $OPTIND - 1` 65 | [ -z "$1" ] || ( [ -z "$WGET" ] && [ -z "$INSTALL" ] ) && abort 66 | 67 | app_exists() { 68 | [ -f "$2/$1" ] && [ -f "$2/$1".md5.txt ] && (cd "$2" && md5sum -cs "$1".md5.txt) 69 | } 70 | 71 | fetch_app() { 72 | echo "Downloading: $1" 73 | wget -cq "$MIRROR"/"$1".md5.txt 2>/dev/null 74 | wget -c "$MIRROR"/"$1" 75 | md5sum -c "$1".md5.txt 76 | if [ "$?" != 0 ]; then 77 | echo "Error on $1" 78 | abort_to_saved_dir 79 | fi 80 | } 81 | 82 | copyInstall() { 83 | [ -d /mnt/test ] || sudo /bin/mkdir -p /mnt/test 84 | sudo /bin/mount $1 /mnt/test -t squashfs -o loop,ro 85 | if [ "$?" == 0 ]; then 86 | if [ "$(ls -A /mnt/test)" ]; then 87 | yes "$FORCE" | sudo /bin/cp -ai /mnt/test/. / 2>/dev/null 88 | [ -d /mnt/test/usr/local/lib/modules/$KERNELVER ] && MODULES=TRUE 89 | fi 90 | sudo /bin/umount -d /mnt/test 91 | fi 92 | [ "$BOOTING" ] || sudo rmdir /mnt/test 93 | } 94 | 95 | update_system() { 96 | if [ "$BOOTING" ]; then 97 | [ "$MODULES" ] && sudo /bin/touch /etc/sysconfig/newmodules 98 | else 99 | [ "$THISAPP" != "$EXTENSION" ] || [ "$DOWNLOAD_ONLY" ] || [ "$LOAD_ONLY" ] || echo "$THISAPP" >> "$TCEDIR"/$ONBOOTNAME 100 | if [ "$MODULES" ]; then 101 | sudo /sbin/depmod -a 2>/dev/null 102 | sudo /sbin/udevadm trigger 103 | fi 104 | sudo /sbin/ldconfig 2>/dev/null 105 | fi 106 | if [ -x "$TCEINSTALLED"/$2 ]; then 107 | if [ "$BOOTING" ] ; then 108 | echo "$TCEINSTALLED"/$2 >> /tmp/setup.lst 109 | else 110 | sudo "$TCEINSTALLED"/$2 111 | fi 112 | else 113 | sudo /bin/touch "$TCEINSTALLED"/$2 114 | fi 115 | } 116 | 117 | install(){ 118 | unset MODULES EMPTYEXT 119 | 120 | if [ "$LANG" != "C" ]; then 121 | LOCALEEXT="${1%.tcz}-locale.tcz" 122 | [ -f "$LOCALEEXT" ] && install "$LOCALEEXT" 123 | fi 124 | 125 | THISAPP="$1" 126 | APPNAME="${THISAPP%.*}" 127 | 128 | if [ "$INSTALL" ]; then 129 | if [ "$COPYINSTALL" ] || [ -e "${FROMWHERE%/*}"/copy2fs.flg ] || grep -qw $APPNAME "${FROMWHERE%/*}"/copy2fs.lst 2>/dev/null; then 130 | copyInstall "$THISAPP" 131 | update_system "$THISAPP" "$APPNAME" 132 | if [ ! "$BOOTING" ]; then 133 | [ -s /etc/sysconfig/desktop ] && desktop.sh "$APPNAME" 134 | fi 135 | else 136 | [ -d /tmp/tcloop/"$APPNAME" ] || sudo /bin/mkdir -p /tmp/tcloop/"$APPNAME" 137 | awk -v appname="/tmp/tcloop/$APPNAME" ' { if ( $2 == appname ) exit 1 }' /etc/mtab 138 | [ "$?" == 1 ] || sudo /bin/mount "$THISAPP" /tmp/tcloop/"$APPNAME" -t squashfs -o loop,ro 2>&1 139 | [ "$?" == 0 ] || abort_to_saved_dir 140 | [ "`find /tmp/tcloop/${APPNAME} -mindepth 1 -maxdepth 2 | wc -l`" -le 1 ] && EMPTYEXT=1 141 | 142 | if [ -z "$EMPTYEXT" ]; then 143 | yes "$FORCE" | sudo /bin/cp -ais /tmp/tcloop/"$APPNAME"/* / 2>/dev/null 144 | [ -d /tmp/tcloop/$APPNAME/usr/local/lib/modules/$KERNELVER ] && MODULES=TRUE 145 | update_system "$THISAPP" "$APPNAME" 146 | if [ ! "$BOOTING" ]; then 147 | [ -s /etc/sysconfig/desktop ] && desktop.sh "$APPNAME" 148 | fi 149 | else 150 | sudo /bin/umount -d /tmp/tcloop/"$APPNAME" 151 | update_system "$THISAPP" "$APPNAME" 152 | fi 153 | fi 154 | [ "$BOOTING" ] && [ "$SHOWAPPS" ] && echo -n "${YELLOW}$APPNAME ${NORMAL}" 155 | fi 156 | 157 | return 0 158 | } 159 | 160 | recursive_scan_dep() { 161 | echo -e "$@"|awk ' 162 | function recursive_scan(name, optional, mirror, _, depfile, line, i) { 163 | gsub(/[\t ]+/, "", name) 164 | if (name) { 165 | sub(/\-KERNEL\.tcz/, "-"KERNELVER".tcz", name) 166 | if (name in MARK) { 167 | if (MARK[name] == 2) { 168 | if (! SUPPRESS) 169 | system("echo Warning loop dependency: "name" 1>&2") 170 | } else { 171 | RESULT[++IDX]="@#"name 172 | } 173 | } else { 174 | IDX+=1 175 | RESULT[IDX]=name 176 | IRANGE[name"#1"]=IDX 177 | depfile=optional"/"name".dep" 178 | if (mirror && (system("test ! -f "depfile) == 0 || system("test ! -f "optional"/"name) == 0)) 179 | if (system("rm -f "depfile"; wget -c -P "optional" "mirror"/"name".dep 2>/dev/null") == 0 && ! SUPPRESS) 180 | system("echo "name".dep OK 1>&2") 181 | MARK[name]=2 182 | if (mirror || system("test -f "optional"/"name) == 0) { 183 | while (getline line < depfile > 0) 184 | recursive_scan(line, optional, mirror) 185 | close(depfile) 186 | } 187 | MARK[name]=1 188 | IRANGE[name"#2"]=IDX 189 | } 190 | } 191 | } 192 | function output(idx1, idx2, _, name, i, refname) { 193 | for (i=idx2; i>=idx1; i--) { 194 | name=RESULT[i] 195 | if (! (name in PRINTED)) { 196 | PRINTED[name]=1 197 | if (substr(name, 1, 2) == "@#") { 198 | refname = substr(name, 3) 199 | output(IRANGE[refname"#1"]+0, IRANGE[refname"#2"]) 200 | } else { 201 | print name 202 | } 203 | } 204 | } 205 | } 206 | BEGIN {KERNELVER="'"$KERNELVER"'"; SUPPRESS="'"$SUPPRESS"'"; IDX=0;} 207 | {pi=IDX; recursive_scan($1, $2 ? $2 : ".", $3); print "@ "$1; output(pi+1, IDX); delete PRINTED;} 208 | ' 209 | } 210 | 211 | # Main 212 | echo "0" > /tmp/appserr 213 | [ -d "$TCEDIR" ] || exit 1 214 | [ -n "$1" ] || exit 1 215 | [ -f /etc/sysconfig/showapps ] && SHOWAPPS=TRUE && SUPPRESS=TRUE 216 | # Check for download only 217 | [ -z "$INSTALL" ] && DOWNLOAD_ONLY=1 218 | [ -z "$WGET" ] && [ "$INSTALL" ] && LOAD_ONLY=1 219 | 220 | OPTIONAL="`realpath $TCEDIR`/optional" 221 | TARGETSLOCAL="" 222 | TARGETSFETCH="" 223 | FROMWHERE="" 224 | 225 | for TARGETAPP in $@; do 226 | 227 | TARGETAPP="${TARGETAPP%.tcz}.tcz" 228 | TARGETAPP="${TARGETAPP/-KERNEL.tcz/-${KERNELVER}.tcz}" 229 | EXTENSION="${TARGETAPP##*/}" 230 | APPNAME="${EXTENSION%.*}" 231 | 232 | if [ -z "$FROMWHERE" ]; then 233 | if [ "$TARGETAPP" = "$EXTENSION" ] && [ ! -f "$EXTENSION" ]; then 234 | FROMWHERE="$OPTIONAL" 235 | else 236 | FROMWHERE=`dirname "$TARGETAPP"` 237 | fi 238 | fi 239 | 240 | # If load local or install then also check if already installed. 241 | if [ "$INSTALL" ] && [ ! "$BOOTING" ]; then 242 | if [ -f "$TCEINSTALLED/$APPNAME" ]; then 243 | echo "$APPNAME is already installed!" 244 | continue 245 | fi 246 | fi 247 | 248 | if [ "$WGET" ]; then 249 | if app_exists "$EXTENSION" "$FROMWHERE"; then 250 | echo "$APPNAME is already downloaded." 251 | TARGETSLOCAL="$TARGETSLOCAL\n$EXTENSION" 252 | else 253 | mkdir -p "$FROMWHERE" 254 | TARGETSFETCH="$TARGETSFETCH\n$EXTENSION" 255 | [ "$DOWNLOAD_ONLY" ] && [ "$ONDEMAND" ] && ondemand "$EXTENSION" 256 | fi 257 | else 258 | TARGETSLOCAL="$TARGETSLOCAL\n$EXTENSION" 259 | fi 260 | 261 | done # Finish the for-loop for multiple extensions 262 | 263 | cd "$FROMWHERE" || exit 1 264 | 265 | if [ "$TARGETSFETCH" ]; then 266 | getMirror 267 | TARGETSFETCH="`echo -e $TARGETSFETCH | awk '/\w/ {print $1" . '"$MIRROR"'"}'`" 268 | recursive_scan_dep "$TARGETSFETCH" | while read F; do 269 | { test "${F%% *}" = "@" && EXTENSION="${F#@ }" && SKIP="" || test "$SKIP"; } && continue 270 | F="${F##*/}" 271 | app_exists "$F" "." || fetch_app "$F" 272 | [ -f "$TCEINSTALLED/${F%.*}" ] || install "$F" 273 | done || exit 1 # subshell cannot exit directly 274 | fi 275 | 276 | if [ "$TARGETSLOCAL" ] && [ "$INSTALL" ]; then 277 | TARGETSLOCAL="`echo -e $TARGETSLOCAL | awk '/\w/ {print $1}'`" 278 | recursive_scan_dep "$TARGETSLOCAL" | while read F; do 279 | { test "${F%% *}" = "@" && EXTENSION="${F#@ }" && SKIP="" || test "$SKIP"; } && continue 280 | F="${F##*/}" 281 | if [ ! -f "$TCEINSTALLED/${F%.*}" ]; then 282 | if [ -f "$F" ]; then 283 | install "$F" 284 | [ "$SUPPRESS" ] || echo "$F: OK" 285 | else 286 | echo "$F not found!" 287 | abort_to_saved_dir 288 | fi 289 | fi 290 | done || exit 1 # subshell cannot exit directly 291 | fi 292 | 293 | [ "$BOOTING" ] && exit 0 294 | [ $(which "$DESKTOP"_restart) ] && "$DESKTOP"_restart 2>/dev/null 295 | exit 0 296 | -------------------------------------------------------------------------------- /etc/init.d/tc-functions: -------------------------------------------------------------------------------- 1 | # Command Line, proc might not be mounted 2 | [ -f /proc/cmdline ] || /bin/mount /proc 3 | CMDLINE=""; CMDLINE=" $(cat /proc/cmdline)" 4 | # ANSI COLORS 5 | CRE="$(echo -e '\r\033[K')" 6 | RED="$(echo -e '\033[1;31m')" 7 | GREEN="$(echo -e '\033[1;32m')" 8 | YELLOW="$(echo -e '\033[1;33m')" 9 | BLUE="$(echo -e '\033[1;34m')" 10 | MAGENTA="$(echo -e '\033[1;35m')" 11 | CYAN="$(echo -e '\033[1;36m')" 12 | WHITE="$(echo -e '\033[1;37m')" 13 | NORMAL="$(echo -e '\033[0;39m')" 14 | 15 | useBusybox() { 16 | for cmd in ar awk cat clear cp cpio cut date dc df du depmod expr fdisk fold \ 17 | grep gunzip hostname kill killall less ls md5sum ps sed \ 18 | sort swapoff swapon sync tar timeout wc wget; do 19 | alias $cmd="busybox $cmd" 20 | done 21 | alias mount="busybox.suid mount" 22 | alias umount="busybox.suid umount" 23 | } 24 | 25 | trim() { echo $1; } 26 | 27 | stringinfile() { 28 | grep -qm1 "$1" "$2" 29 | } 30 | 31 | stringinstring(){ 32 | case "$2" in *$1*) return 0;; esac 33 | return 1 34 | } 35 | 36 | getbootparam(){ 37 | stringinstring " $1=" "$CMDLINE" || return 1 38 | result="${CMDLINE##* $1=}" 39 | result="${result%%[ ]*}" 40 | echo "$result" 41 | return 0 42 | } 43 | 44 | getparam(){ 45 | stringinstring " $1=" "$2" || return 1 46 | result="${2##*$1=}" 47 | result="${result%%[ ]*}" 48 | echo "$result" 49 | return 0 50 | } 51 | 52 | checkbootparam(){ 53 | stringinstring " $1" "$CMDLINE" 54 | return "$?" 55 | } 56 | 57 | getbasefile(){ 58 | echo -e "${1##*/}"|awk -v n="$2" '{for (i=n; i>0; i--) sub(/\.[^\.]*$/, ""); print;}' 59 | return 0 60 | } 61 | 62 | mounted(){ 63 | grep $1 /etc/mtab >/dev/null 2>&1 64 | if [ $? == 0 ]; then return 0; fi 65 | return 1 66 | } 67 | 68 | find_mountpoint() { 69 | MOUNTPOINT="" 70 | MOUNTED="no" 71 | D2="$1" 72 | if [ "$D2" == "nfs" ]; then 73 | MOUNTPOINT=/mnt/nfs 74 | MOUNTED="yes" 75 | return 76 | fi 77 | if [ "${D2:0:5}" == "UUID=" ]; then 78 | D2=`/sbin/blkid -lt $D2 -o device` 79 | if [ "$?" != 0 ]; then 80 | MOUNTPOINT="" 81 | return 82 | else 83 | D2="${D2%%:*}" 84 | fi 85 | elif [ "${D2:0:6}" == "LABEL=" ]; then 86 | D2=`/sbin/blkid -lt $D2 -o device` 87 | if [ "$?" != 0 ]; then 88 | MOUNTPOINT="" 89 | return 90 | else 91 | D2="${D2%%:*}" 92 | fi 93 | else 94 | D2=/dev/$D2 95 | fi 96 | MOUNTPOINT="$(grep -i ^$D2\ /etc/mtab|awk '{print $2}'|head -n 1)" 97 | if [ -n "$MOUNTPOINT" ]; then 98 | MOUNTED="yes" 99 | return 100 | fi 101 | 102 | # Special case for virtual disk 103 | if [ "$D2" == "/dev/tcvd" ]; then 104 | MOUNTPOINT="$(awk '/\/mnt\/tcvd/{print $2}' /etc/mtab|head -n 1)" 105 | if [ -n "$MOUNTPOINT" ]; then 106 | MOUNTED="yes" 107 | return 108 | fi 109 | fi 110 | 111 | MOUNTPOINT="$(grep -i ^$D2\ /etc/fstab|awk '{print $2}'|head -n 1)" 112 | } 113 | 114 | tc_autoscan(){ 115 | FOUND="" 116 | for DEVICE in `autoscan-devices`; do 117 | find_mountpoint $DEVICE 118 | if [ -n "$MOUNTPOINT" ]; then 119 | if [ "$MOUNTED" == "no" ]; then 120 | mount "$MOUNTPOINT" >/dev/null 2>&1 121 | fi 122 | if [ "-$2" "$MOUNTPOINT"/$1 ]; then 123 | FOUND="yes" 124 | fi 125 | if [ "$MOUNTED" == "no" ]; then 126 | umount "$MOUNTPOINT" >/dev/null 2>&1 127 | fi 128 | if [ -n "$FOUND" ]; then 129 | echo "$DEVICE" 130 | return 0 131 | fi 132 | fi 133 | done 134 | DEVICE="" 135 | return 1 136 | } 137 | 138 | getpasswd(){ 139 | readpassword(){ 140 | PASSWD="" 141 | until [ ${#PASSWD} -ge 8 ] && [ ${#PASSWD} -le 56 ]; do 142 | PASSWD="" 143 | if [ "$2" == "confirm" ]; then 144 | echo 145 | echo -n "${BLUE} Re-enter${NORMAL}: " 146 | else 147 | echo -n "${BLUE}Enter password (8 to 56 characters) for ${YELLOW}$1${NORMAL}: " 148 | fi 149 | read -s PASSWD 150 | [ ${#PASSWD} -lt 8 ] && echo " Password is too short!" 151 | [ ${#PASSWD} -gt 56 ] && echo " Password is too long!" 152 | done 153 | } 154 | OK=0 155 | until [ "$OK" == 1 ]; do 156 | readpassword $1 157 | PASSWD1=$PASSWD 158 | readpassword $1 confirm 159 | if [ "$PASSWD1" == "$PASSWD" ]; then 160 | OK=1 161 | echo " ${GREEN}Accepted.${NORMAL}" 162 | else 163 | echo " ${RED}Mismatch.${NORMAL}" 164 | fi 165 | done 166 | return 0 167 | } 168 | 169 | status() { 170 | if [ $? -eq 0 ]; then 171 | result="${YELLOW}OK${NORMAL}" 172 | else 173 | result="${RED}Failed${NORMAL}" 174 | fi 175 | echo -e "\\033[70G[ ${result} ]" 176 | } 177 | 178 | usleep_progress() { 179 | # Wait 2 seconds 180 | CHAR='.' 181 | for i in `seq 1 79` 182 | do 183 | echo -n "$CHAR" 184 | usleep 25316 185 | done 186 | echo "$CHAR" 187 | } 188 | 189 | checkroot() { 190 | if [ `/usr/bin/id -u` -ne 0 ]; then 191 | echo "Need root privileges." >&2 192 | exit 1 193 | fi 194 | } 195 | 196 | checknotroot() { 197 | if [ `/usr/bin/id -u` -eq 0 ]; then 198 | echo "Don't run this as root." >&2 199 | exit 1 200 | fi 201 | } 202 | 203 | checkX() { 204 | if [ -z ${DISPLAY} ]; then 205 | echo "Requires X windows." >&2 206 | exit 1 207 | fi 208 | } 209 | 210 | setupHome(){ 211 | read USER < /etc/sysconfig/tcuser 212 | if [ ! -d /home/"$USER" ] || [ "`ls -la /home/${USER} | wc -l`" -le 3 ] 213 | then 214 | mkdir -p /home/"$USER"/.X.d 215 | mkdir -p /home/"$USER"/.local/bin 216 | chown -R "$USER":staff /home/"$USER/" 217 | chmod -R g+s,o-rwx /home/"$USER/" 218 | fi 219 | LIST=`mktemp` 220 | > "$LIST" 221 | for S in `find /etc/skel -type f` 222 | do 223 | ITEM="${S#/etc/skel/}" 224 | if [ ! -e /home/"$USER"/"$ITEM" ] 225 | then 226 | echo "$ITEM" >> "$LIST" 227 | fi 228 | done 229 | if [ -s "$LIST" ] 230 | then 231 | tar -C /etc/skel -T "$LIST" -cf - | tar -C /home/"$USER" -xf - 232 | while read ITEM 233 | do chown -R "$USER":staff /home/"$USER"/"${ITEM%%/*}" 234 | done < "$LIST" 235 | fi 236 | rm "$LIST" 2>/dev/null 237 | } 238 | 239 | merge() { 240 | awk -v mergedata="$1" -v target="$3" ' 241 | { 242 | if ( index($0,target) ) 243 | { 244 | while (( getline item < mergedata ) > 0 ) 245 | print item 246 | close(mergedata) 247 | } 248 | print $0 249 | } ' "$2" 250 | } 251 | 252 | replace() { 253 | awk -v mergedata="$1" -v target="$3" ' 254 | { 255 | if ( index($0,target) ) 256 | { 257 | while (( getline item < mergedata ) > 0 ) 258 | print item 259 | close(mergedata) 260 | } else print $0 261 | } ' "$2" 262 | } 263 | 264 | purge(){ 265 | awk -v startTarget="$2" -v endTarget="$3" ' 266 | BEGIN { writeFlag=1 } 267 | { 268 | if (index($0, startTarget)) 269 | { 270 | print $0 271 | writeFlag=0 272 | } else 273 | if (index($0, endTarget)) writeFlag=1 274 | 275 | if (writeFlag) print $0 276 | } ' "$1" 277 | } 278 | 279 | getFullVer() { 280 | verid=$(grep '^VERSION_ID=' /etc/os-release) 281 | echo ${verid#*=} 282 | } 283 | 284 | getMajorVer() { 285 | fullver=$(getFullVer) 286 | echo ${fullver%.*} 287 | } 288 | 289 | getBuild() { 290 | BUILD=`uname -m` 291 | case ${BUILD} in 292 | armv6l) echo "armv6" ;; 293 | armv7l) echo "armv7" ;; 294 | aarch64) echo "aarch64" ;; 295 | i686) echo "x86" ;; 296 | x86_64) [ -f /lib/ld-linux-x86-64.so.2 ] && echo "x86_64" || echo "x86" ;; 297 | *) echo "x86" ;; 298 | esac 299 | } 300 | 301 | getMirror() { 302 | BUILD="$1" 303 | [ -z "$BUILD" ] && BUILD=$(getBuild) 304 | read MIRROR < /opt/tcemirror 305 | 306 | MIRRORPROTO="${MIRROR%%://*}" 307 | MIRROR="${MIRROR%/}/$(getMajorVer).x/$BUILD/tcz" 308 | 309 | # if this is changed also change /usr/bin/tcemirror.sh 310 | 311 | # supported protocols for mirror 312 | if 313 | [ "$MIRRORPROTO" != "http" ] && 314 | [ "$MIRRORPROTO" != "https" ] && 315 | [ "$MIRRORPROTO" != "ftp" ]; then 316 | echo "Mirror must use http[s] or ftp" 317 | exit 1 318 | fi 319 | 320 | # https mirrors can't be done without some extensions 321 | if [ "$MIRRORPROTO" == "https" ]; then 322 | # Test if the required extensions are installed 323 | [ -e /usr/local/tce.installed/ca-certificates ] || NeedCrt=1 324 | [ -e /usr/local/tce.installed/openssl ] || NeedSSL=1 325 | 326 | if [ -n "$NeedCrt$NeedSSL" ]; then 327 | { 328 | echo "The following are required before using https mirrors:" 329 | [ -n "$NeedCrt" ] && echo "ca-certificates.tcz" 330 | [ -n "$NeedSSL" ] && echo "openssl.tcz" 331 | echo "Press q to exit" 332 | } | less 333 | exit 1 334 | fi 335 | fi 336 | } 337 | 338 | installed() { 339 | if [ -e /usr/local/tce.installed/${1%.*} ]; then 340 | return 0 341 | else 342 | return 1 343 | fi 344 | } 345 | 346 | getKeyEventDevice() { 347 | e=0 348 | for i in /sys/class/input/input*/name; do 349 | if grep -q "eyboard" $i; then break; fi 350 | e=`busybox expr "$e" + 1` 351 | done 352 | [ $e -gt 0 ] || exit 1 353 | echo /dev/input/event$e 354 | } 355 | 356 | parentOf() 357 | { 358 | PID=$(pidof $1) || return 359 | PPID=$(awk '/^PPid:/{print $2}' /proc/$PID/status) 360 | awk '/^Name:/{print $2}' /proc/$PPID/status 361 | } 362 | 363 | myParent() 364 | { 365 | PID=$$ 366 | PPID=$(awk '/^PPid:/{print $2}' /proc/$PID/status) 367 | awk '/^Name:/{print $2}' /proc/$PPID/status 368 | } 369 | 370 | launchApp() { 371 | FREEDESKTOP=/usr/local/share/applications 372 | if [ -e "$FREEDESKTOP"/"$1".desktop ] 373 | then 374 | E=`awk 'BEGIN{FS="Exec="}/^Exec/{print $2}' "$FREEDESKTOP"/"$1".desktop` 375 | E="${E% \%*}" 376 | T=`awk 'BEGIN{FS="Terminal="}/^Terminal/{print $2}' "$FREEDESKTOP"/"$1".desktop` 377 | shift 1 378 | if [ "$1" != "cliorx" ] && `echo $T | grep -qi true` 379 | then 380 | exec cliorx ${E} "$@" & 381 | else 382 | exec ${E} "$@" & 383 | fi 384 | else 385 | fullpath=`which $1` 386 | if [ "$?" -eq 0 ] && `echo $fullpath | grep -qv ondemand` 387 | then 388 | E=$1 389 | shift 1 390 | exec $E "$@" & 391 | else 392 | echo "Already loaded. Call from regular menu or terminal." 393 | printf "\a" 394 | fi 395 | fi 396 | } 397 | -------------------------------------------------------------------------------- /usr/bin/filetool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/busybox ash 2 | # Original script by Robert Shingledecker 3 | # (c) Robert Shingledecker 2003-2012 4 | # A simple script to save/restore configs, directories, etc defined by the user 5 | # in the file .filetool.lst 6 | # Added ideas from WDef for invalid device check and removal of bfe password upon failure 7 | # Added comparerestore and dry run (Brian Smith) 8 | # Added colors (Alphons van der Heijden) 9 | . /etc/init.d/tc-functions 10 | useBusybox 11 | 12 | K=1024 13 | M=$(($K * $K)) 14 | 15 | Fixed3Div() 16 | { 17 | # divide $1 by $2. Return result to 3 decimal places, no rounding. 18 | printf "%d.%03d\n" $(($1 / $2)) $(((($1 % $2) * 1000) / $2)) 19 | } 20 | 21 | CMDLINE="$(cat /proc/cmdline)" 22 | 23 | MYDATA=mydata 24 | [ -r /etc/sysconfig/mydata ] && read MYDATA < /etc/sysconfig/mydata 25 | # Functions -- 26 | 27 | abort(){ 28 | echo "${RED}Usage: ${BLUE}filetool.sh ${MAGENTA}options ${YELLOW}device${NORMAL}" 29 | echo "Where required action options are:" 30 | echo "${MAGENTA}-b${NORMAL} backup" 31 | echo "${MAGENTA}-r${NORMAL} restore" 32 | echo "${MAGENTA}-s${NORMAL} safe backup mode" 33 | echo "${MAGENTA}-d${NORMAL} dry run backup" 34 | echo "Optional display options are:" 35 | echo "${MAGENTA}-p${NORMAL} prompted verbose listing" 36 | echo "${MAGENTA}-v${NORMAL} verbose listing" 37 | echo -n "Press enter to continue:" ; read ans 38 | exit 1 39 | } 40 | 41 | blowfish_encrypt(){ 42 | KEY=$(sudo /bin/cat /etc/sysconfig/bfe) 43 | cat << EOD | sudo /usr/bin/bcrypt -c "$MOUNTPOINT"/"$FULLPATH"/$1 2>/dev/null 44 | "$KEY" 45 | "$KEY" 46 | EOD 47 | if [ "$?" != 0 ]; then failed; fi 48 | sync 49 | } 50 | 51 | # clean_up and failed - from non-interactive boot time use. 52 | clean_up(){ 53 | if [ $MOUNTED == "no" ]; then 54 | sudo /bin/umount $MOUNTPOINT 55 | fi 56 | # Only store device name if backup/restore successful 57 | [ $1 -eq 0 ] && echo "${D2#/dev/}"/$FULLPATH > /etc/sysconfig/backup_device 58 | # Remove bfe password if decryption fails 59 | [ $1 -eq 98 ] && sudo /bin/rm -f /etc/sysconfig/bfe 60 | sync 61 | exit $1 62 | } 63 | 64 | failed(){ 65 | echo "${MAGENTA}WARNING: Selected operation has failed. Proceed with extreme caution.${NORMAL}" 66 | [ "$PROMPT" ] && echo -n "Press enter to continue:" && read ans 67 | clean_up 98 68 | } 69 | 70 | # wrapup from after boot to handle both interacive not called from GUI 71 | wrapup(){ 72 | if [ -s /tmp/backup_status ] && [ "$VERBOSE" ] 73 | then 74 | cat /tmp/backup_status 75 | [ "$PROMPT" ] && echo -n "Press enter to continue:" && read ans 76 | fi 77 | exit 1 78 | } 79 | 80 | # Main -- 81 | unset BACKUP PROMPT RESTORE SAFE DRYRUN VERBOSE 82 | 83 | [ -z $1 ] && abort 84 | if grep -q "safebackup" /proc/cmdline; then SAFE=TRUE; fi 85 | while getopts bprsdv OPTION 86 | do 87 | case ${OPTION} in 88 | b) BACKUP=TRUE ;; 89 | p) PROMPT=TRUE ;; 90 | r) RESTORE=TRUE ;; 91 | s) SAFE=TRUE ;; 92 | d) DRYRUN=TRUE ;; 93 | v) VERBOSE=TRUE ;; 94 | *) abort ;; 95 | esac 96 | done 97 | [ "$BACKUP" ] && [ "$RESTORE" ] && abort 98 | shift `expr $OPTIND - 1` 99 | # TARGET device is now $1 100 | 101 | [ "$PROMPT" ] && VERBOSE=TRUE 102 | 103 | if [ $DRYRUN ]; then 104 | echo "${BLUE}Performing dry run backup (backup will not actually take place). Please wait.${NORMAL}"; echo 105 | totalcompressedsize=`sudo /bin/tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst -cvzf - 2>/tmp/backup_dryrun_list | wc -c` 106 | while read entry; do 107 | if [ -f "/${entry}" ]; then 108 | size=`sudo /bin/ls -al "/${entry}" | awk '{print $5}'` 109 | totalsize=$(($totalsize + $size)) 110 | sizemb=`Fixed3Div $size $M` 111 | printf "%6.2f MB ${YELLOW}/%s${NORMAL}\n" $sizemb "$entry" 112 | fi 113 | done < /tmp/backup_dryrun_list 114 | rm /tmp/backup_dryrun_list 115 | totalsizemb=`Fixed3Div $totalsize $M` 116 | totalcompressedsizemb=`Fixed3Div $totalcompressedsize $M` 117 | printf "\n${BLUE}Total backup size (uncompressed): ${NORMAL}%6.2f MB (%d bytes)\n" $totalsizemb $totalsize 118 | printf "${BLUE}Total backup size (compressed) : ${NORMAL}%6.2f MB (%d bytes)\n\n" $totalcompressedsizemb $totalcompressedsize 119 | exit 0 120 | fi 121 | 122 | #Get the TARGET name from argument 1 or /etc/sysconfig/backup_device 123 | if [ -z $1 ]; then 124 | TARGET="$(cat /etc/sysconfig/backup_device 2>/dev/null)" 125 | else 126 | TARGET="$1" 127 | fi 128 | 129 | if [ -z "$TARGET" ]; then 130 | # Last chance to default to persistent TCE directory if exists 131 | TCEDIR="$(readlink /etc/sysconfig/tcedir)" 132 | if [ "$TCEDIR" == "/tmp/tce" ]; then 133 | echo "${RED}Invalid or not found ${YELLOW}$TARGET${NORMAL}" > /tmp/backup_status 134 | wrapup 135 | else 136 | TARGET="${TCEDIR#/mnt/}" 137 | fi 138 | fi 139 | 140 | TARGET="${TARGET#/dev/}" 141 | DEVICE="${TARGET%%/*}" 142 | FULLPATH="${TARGET#$DEVICE/}" 143 | [ "$FULLPATH" = "$DEVICE" ] && FULLPATH="" 144 | 145 | find_mountpoint $DEVICE 146 | 147 | if [ -z "$MOUNTPOINT" ]; then 148 | echo "${RED}Invalid device ${YELLOW}$DEVICE${NORMAL}" > /tmp/backup_status 149 | wrapup 150 | fi 151 | 152 | if [ $MOUNTED == "no" ]; then 153 | sudo /bin/mount $MOUNTPOINT 154 | if [ "$?" != 0 ]; then 155 | echo "${RED}Unable to mount device ${YELLOW}$DEVICE${NORMAL}" > /tmp/backup_status 156 | wrapup 157 | fi 158 | fi 159 | 160 | echo "${D2#/dev/}"/$FULLPATH > /etc/sysconfig/backup_device 161 | 162 | trap failed SIGTERM 163 | 164 | if [ "$BACKUP" ] ; then 165 | # Use a dummy file to save .filetool.lst's timestamp, so we can restore it after sed changes it 166 | dummy=$(mktemp); touch -r /opt/.filetool.lst $dummy 167 | sed -i /^$/d /opt/.filetool.lst 168 | touch -r $dummy /opt/.filetool.lst; rm $dummy 169 | if [ "$SAFE" ]; then 170 | if [ -r $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz.bfe -o -r $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz ]; then 171 | echo -n "${BLUE}Copying existing backup to ${YELLOW}$MOUNTPOINT/"$FULLPATH"/${MYDATA}bk.[tgz|tgz.bfe]${BLUE} .. " 172 | sudo /bin/mv -f $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz $MOUNTPOINT/"$FULLPATH"/${MYDATA}bk.tgz 2>/dev/null || sudo /bin/mv -f $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz.bfe $MOUNTPOINT/"$FULLPATH"/${MYDATA}bk.tgz.bfe 2>/dev/null 173 | if [ "$?" == 0 ]; then 174 | echo "${GREEN}Done.${NORMAL}" 175 | else 176 | echo -e "\n${RED}Error: Unable to rename ${YELLOW}${MYDATA}.tgz ${RED}to ${YELLOW}${MYDATA}bk.tgz${NORMAL}" 177 | exit 2 178 | fi 179 | else 180 | echo "${MAGENTA}Neither ${YELLOW}${MYDATA}.tgz${MAGENTA} nor ${YELLOW}${MYDATA}.tgz.bfe${MAGENTA} exist. ${BLUE}Proceeding with creation of initial backup ...${NORMAL}" 181 | fi 182 | fi 183 | if [ "$VERBOSE" ]; then 184 | sudo /bin/tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst -czvf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz 185 | [ "$PROMPT" ] && echo -n "Press enter to continue:" && read ans 186 | else 187 | echo -n "${BLUE}Backing up files to ${YELLOW}$MOUNTPOINT/$FULLPATH/${MYDATA}.tgz ${BLUE}" 188 | [ -f /tmp/backup_status ] && sudo /bin/rm -f /tmp/backup_status 189 | sudo /bin/tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst -czf "$MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz" 2>/tmp/backup_status & 190 | rotdash $! 191 | sync 192 | [ -s /tmp/backup_status ] && sed -i '/socket ignored/d' /tmp/backup_status 2>/dev/null 193 | [ -s /tmp/backup_status ] && { echo -e "\n${RED}There was an issue, see ${YELLOW}/tmp/backup_status${RED}.${NORMAL}"; exit 1; } 194 | touch /tmp/backup_done 195 | fi 196 | if [ -f /etc/sysconfig/bfe ]; then 197 | echo -n "${BLUE}encrypting .. ${NORMAL} " 198 | blowfish_encrypt ${MYDATA}.tgz 199 | fi 200 | echo "${GREEN}Done.${NORMAL}" 201 | clean_up 0 202 | fi 203 | 204 | if [ "$RESTORE" ] ; then 205 | if [ -f /etc/sysconfig/bfe ]; then 206 | TARGETFILE="${MYDATA}.tgz.bfe" 207 | else 208 | TARGETFILE="${MYDATA}.tgz" 209 | fi 210 | 211 | if [ ! -f $MOUNTPOINT/"$FULLPATH"/$TARGETFILE ] ; then 212 | if [ $MOUNTED == "no" ]; then 213 | sudo /bin/umount $MOUNTPOINT 214 | fi 215 | fi 216 | 217 | if [ -f /etc/sysconfig/bfe ] && [ -f "$MOUNTPOINT"/"$FULLPATH"/"$TARGETFILE" ]; then 218 | KEY=$(sudo /bin/cat /etc/sysconfig/bfe) 219 | cat << EOD | sudo /usr/bin/bcrypt -o "$MOUNTPOINT"/"$FULLPATH"/"$TARGETFILE" 2>/dev/null >/dev/null 220 | "$KEY" 221 | EOD 222 | if [ "$?" != 0 ]; then failed; fi 223 | if grep -q "comparerestore" /proc/cmdline && [ ! -e /etc/sysconfig/comparerestore ]; then 224 | for file in `cat << EOD | /usr/bin/bcrypt -o "$MOUNTPOINT"/"$FULLPATH"/$TARGETFILE 2>/dev/null | tar -tzf - 225 | "$KEY" 226 | EOD`; do 227 | if [ -f "/${file}" ]; then 228 | sudo /bin/mv "/${file}" "/${file}.orig_file" 229 | fi 230 | done 231 | sudo /bin/touch /etc/sysconfig/comparerestore 232 | fi 233 | 234 | if [ "$VERBOSE" ]; then 235 | cat << EOD | sudo /usr/bin/bcrypt -o "$MOUNTPOINT"/"$FULLPATH"/$TARGETFILE 2>/dev/null | sudo /bin/tar -C / -zxvf - 236 | "$KEY" 237 | EOD 238 | if [ "$?" != 0 ]; then failed; fi 239 | else 240 | echo -n "${BLUE}Restoring backup files from encrypted backup ${YELLOW}$MOUNTPOINT/$FULLPATH ${BLUE}mounted over device ${YELLOW}$D2 ${NORMAL}" 241 | cat << EOD | sudo /usr/bin/bcrypt -o "$MOUNTPOINT"/"$FULLPATH"/$TARGETFILE 2>/dev/null | sudo /bin/tar -C / -zxf - 242 | "$KEY" 243 | EOD 244 | if [ "$?" != 0 ]; then failed; fi 245 | echo "${GREEN}Done.${NORMAL}" 246 | fi 247 | clean_up 0 248 | else 249 | if [ -f /etc/sysconfig/bfe ]; then 250 | echo 251 | echo "${MAGENTA}Warning PROTECT boot code used and encrypted backup file not found!" 252 | echo "Proceeding with normal restore operations." 253 | echo "Encryption will occur upon next backup or shutdown.${NORMAL}" 254 | [ "$PROMPT" ] && echo -n "Press enter to continue:" && read ans 255 | fi 256 | fi 257 | # End bfe 258 | 259 | if grep -q "comparerestore" /proc/cmdline && [ ! -e /etc/sysconfig/comparerestore ]; then 260 | for file in `tar -tzf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz`; do 261 | if [ -f "/${file}" ]; then 262 | sudo /bin/mv "/${file}" "/${file}.orig_file" 263 | fi 264 | done 265 | sudo /bin/touch /etc/sysconfig/comparerestore 266 | fi 267 | 268 | if [ "$VERBOSE" ]; then 269 | sudo /bin/tar -C / -zxvf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz 270 | [ "$PROMPT" ] && echo -n "Press enter to continue:" && read ans 271 | else 272 | echo -n "${BLUE}Restoring backup files from ${YELLOW}$MOUNTPOINT/$FULLPATH/${MYDATA}.tgz${NORMAL} " 273 | sudo /bin/tar -C / -zxf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz 2>/dev/null & 274 | rotdash $! 275 | echo "${GREEN}Done.${NORMAL}" 276 | fi 277 | clean_up 0 278 | fi 279 | echo "${RED}Required action flag is missing:${YELLOW} $1 ${NORMAL}" 280 | abort 281 | -------------------------------------------------------------------------------- /etc/services: -------------------------------------------------------------------------------- 1 | # /etc/services: 2 | # $Id: services,v 1.4 2000/01/23 21:03:36 notting Exp $ 3 | # 4 | # Network services, Internet style 5 | # 6 | # Note that it is presently the policy of IANA to assign a single well-known 7 | # port number for both TCP and UDP; hence, most entries here have two entries 8 | # even if the protocol doesn't support UDP operations. 9 | # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports 10 | # are included, only the more common ones. 11 | 12 | tcpmux 1/tcp # TCP port service multiplexer 13 | echo 7/tcp 14 | echo 7/udp 15 | discard 9/tcp sink null 16 | discard 9/udp sink null 17 | systat 11/tcp users 18 | daytime 13/tcp 19 | daytime 13/udp 20 | netstat 15/tcp 21 | qotd 17/tcp quote 22 | msp 18/tcp # message send protocol 23 | msp 18/udp # message send protocol 24 | chargen 19/tcp ttytst source 25 | chargen 19/udp ttytst source 26 | ftp-data 20/tcp 27 | ftp 21/tcp 28 | fsp 21/udp fspd 29 | ssh 22/tcp # SSH Remote Login Protocol 30 | ssh 22/udp # SSH Remote Login Protocol 31 | telnet 23/tcp 32 | # 24 - private 33 | smtp 25/tcp mail 34 | # 26 - unassigned 35 | time 37/tcp timserver 36 | time 37/udp timserver 37 | rlp 39/udp resource # resource location 38 | nameserver 42/tcp name # IEN 116 39 | whois 43/tcp nicname 40 | re-mail-ck 50/tcp # Remote Mail Checking Protocol 41 | re-mail-ck 50/udp # Remote Mail Checking Protocol 42 | domain 53/tcp nameserver # name-domain server 43 | domain 53/udp nameserver 44 | mtp 57/tcp # deprecated 45 | bootps 67/tcp # BOOTP server 46 | bootps 67/udp 47 | bootpc 68/tcp # BOOTP client 48 | bootpc 68/udp 49 | tftp 69/udp 50 | gopher 70/tcp # Internet Gopher 51 | gopher 70/udp 52 | rje 77/tcp netrjs 53 | finger 79/tcp 54 | www 80/tcp http # WorldWideWeb HTTP 55 | www 80/udp # HyperText Transfer Protocol 56 | link 87/tcp ttylink 57 | kerberos 88/tcp kerberos5 krb5 # Kerberos v5 58 | kerberos 88/udp kerberos5 krb5 # Kerberos v5 59 | supdup 95/tcp 60 | # 100 - reserved 61 | hostnames 101/tcp hostname # usually from sri-nic 62 | iso-tsap 102/tcp tsap # part of ISODE. 63 | csnet-ns 105/tcp cso-ns # also used by CSO name server 64 | csnet-ns 105/udp cso-ns 65 | # unfortunately the poppassd (Eudora) uses a port which has already 66 | # been assigned to a different service. We list the poppassd as an 67 | # alias here. This should work for programs asking for this service. 68 | # (due to a bug in inetd the 3com-tsmux line is disabled) 69 | #3com-tsmux 106/tcp poppassd 70 | #3com-tsmux 106/udp poppassd 71 | rtelnet 107/tcp # Remote Telnet 72 | rtelnet 107/udp 73 | pop2 109/tcp pop-2 postoffice # POP version 2 74 | pop2 109/udp pop-2 75 | pop3 110/tcp pop-3 # POP version 3 76 | pop3 110/udp pop-3 77 | rpcbind 111/tcp portmapper # RPC 4.0 portmapper TCP 78 | rpcbind 111/udp portmapper # RPC 4.0 portmapper UDP 79 | auth 113/tcp authentication tap ident 80 | sftp 115/tcp 81 | uucp-path 117/tcp 82 | nntp 119/tcp readnews untp # USENET News Transfer Protocol 83 | ntp 123/tcp 84 | ntp 123/udp # Network Time Protocol 85 | netbios-ns 137/tcp # NETBIOS Name Service 86 | netbios-ns 137/udp 87 | netbios-dgm 138/tcp # NETBIOS Datagram Service 88 | netbios-dgm 138/udp 89 | netbios-ssn 139/tcp # NETBIOS session service 90 | netbios-ssn 139/udp 91 | imap2 143/tcp imap # Interim Mail Access Proto v2 92 | imap2 143/udp imap 93 | snmp 161/udp # Simple Net Mgmt Proto 94 | snmp-trap 162/udp snmptrap # Traps for SNMP 95 | cmip-man 163/tcp # ISO mgmt over IP (CMOT) 96 | cmip-man 163/udp 97 | cmip-agent 164/tcp 98 | cmip-agent 164/udp 99 | xdmcp 177/tcp # X Display Mgr. Control Proto 100 | xdmcp 177/udp 101 | nextstep 178/tcp NeXTStep NextStep # NeXTStep window 102 | nextstep 178/udp NeXTStep NextStep # server 103 | bgp 179/tcp # Border Gateway Proto. 104 | bgp 179/udp 105 | prospero 191/tcp # Cliff Neuman's Prospero 106 | prospero 191/udp 107 | irc 194/tcp # Internet Relay Chat 108 | irc 194/udp 109 | smux 199/tcp # SNMP Unix Multiplexer 110 | smux 199/udp 111 | at-rtmp 201/tcp # AppleTalk routing 112 | at-rtmp 201/udp 113 | at-nbp 202/tcp # AppleTalk name binding 114 | at-nbp 202/udp 115 | at-echo 204/tcp # AppleTalk echo 116 | at-echo 204/udp 117 | at-zis 206/tcp # AppleTalk zone information 118 | at-zis 206/udp 119 | qmtp 209/tcp # The Quick Mail Transfer Protocol 120 | qmtp 209/udp # The Quick Mail Transfer Protocol 121 | z3950 210/tcp wais # NISO Z39.50 database 122 | z3950 210/udp wais 123 | ipx 213/tcp # IPX 124 | ipx 213/udp 125 | imap3 220/tcp # Interactive Mail Access 126 | imap3 220/udp # Protocol v3 127 | rpc2portmap 369/tcp 128 | rpc2portmap 369/udp # Coda portmapper 129 | codaauth2 370/tcp 130 | codaauth2 370/udp # Coda authentication server 131 | ulistserv 372/tcp # UNIX Listserv 132 | ulistserv 372/udp 133 | ldap 389/tcp # Lightweight Directory Access Protocol 134 | ldap 389/udp # Lightweight Directory Access Protocol 135 | https 443/tcp # MCom 136 | https 443/udp # MCom 137 | snpp 444/tcp # Simple Network Paging Protocol 138 | snpp 444/udp # Simple Network Paging Protocol 139 | saft 487/tcp # Simple Asynchronous File Transfer 140 | saft 487/udp # Simple Asynchronous File Transfer 141 | npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS 142 | npmp-local 610/udp dqs313_qmaster # npmp-local / DQS 143 | npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS 144 | npmp-gui 611/udp dqs313_execd # npmp-gui / DQS 145 | hmmp-ind 612/tcp dqs313_intercell# HMMP Indication / DQS 146 | hmmp-ind 612/udp dqs313_intercell# HMMP Indication / DQS 147 | # 148 | # UNIX specific services 149 | # 150 | exec 512/tcp 151 | biff 512/udp comsat 152 | login 513/tcp 153 | who 513/udp whod 154 | shell 514/tcp cmd # no passwords used 155 | syslog 514/udp 156 | printer 515/tcp spooler # line printer spooler 157 | talk 517/udp 158 | ntalk 518/udp 159 | route 520/udp router routed # RIP 160 | timed 525/udp timeserver 161 | tempo 526/tcp newdate 162 | courier 530/tcp rpc 163 | conference 531/tcp chat 164 | netnews 532/tcp readnews 165 | netwall 533/udp # -for emergency broadcasts 166 | uucp 540/tcp uucpd # uucp daemon 167 | afpovertcp 548/tcp # AFP over TCP 168 | afpovertcp 548/udp # AFP over TCP 169 | remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem 170 | klogin 543/tcp # Kerberized `rlogin' (v5) 171 | kshell 544/tcp krcmd # Kerberized `rsh' (v5) 172 | kerberos-adm 749/tcp # Kerberos `kadmin' (v5) 173 | # 174 | webster 765/tcp # Network dictionary 175 | webster 765/udp 176 | swat 901/tcp # Samba Web Administration Tool 177 | # 178 | # From ``Assigned Numbers'': 179 | # 180 | #> The Registered Ports are not controlled by the IANA and on most systems 181 | #> can be used by ordinary user processes or programs executed by ordinary 182 | #> users. 183 | # 184 | #> Ports are used in the TCP [45,106] to name the ends of logical 185 | #> connections which carry long term conversations. For the purpose of 186 | #> providing services to unknown callers, a service contact port is 187 | #> defined. This list specifies the port used by the server process as its 188 | #> contact port. While the IANA can not control uses of these ports it 189 | #> does register or list uses of these ports as a convienence to the 190 | #> community. 191 | # 192 | ingreslock 1524/tcp 193 | ingreslock 1524/udp 194 | prospero-np 1525/tcp # Prospero non-privileged 195 | prospero-np 1525/udp 196 | datametrics 1645/tcp old-radius # datametrics / old radius entry 197 | datametrics 1645/udp old-radius # datametrics / old radius entry 198 | sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry 199 | sa-msg-port 1646/udp old-radacct # sa-msg-port / old radacct entry 200 | radius 1812/tcp # Radius 201 | radius 1812/udp # Radius 202 | radacct 1813/tcp # Radius Accounting 203 | radacct 1813/udp # Radius Accounting 204 | nfs 2049/tcp # Network File System 205 | nfs 2049/udp # Network File System 206 | cvspserver 2401/tcp # CVS client/server operations 207 | cvspserver 2401/udp # CVS client/server operations 208 | venus 2430/tcp # codacon port 209 | venus 2430/udp # Venus callback/wbc interface 210 | venus-se 2431/tcp # tcp side effects 211 | venus-se 2431/udp # udp sftp side effect 212 | codasrv 2432/tcp # not used 213 | codasrv 2432/udp # server port 214 | codasrv-se 2433/tcp # tcp side effects 215 | codasrv-se 2433/udp # udp sftp side effect 216 | mysql 3306/tcp # MySQL 217 | mysql 3306/udp # MySQL 218 | rfe 5002/tcp # Radio Free Ethernet 219 | rfe 5002/udp # Actually uses UDP only 220 | cfengine 5308/tcp # CFengine 221 | cfengine 5308/udp # CFengine 222 | bbs 7000/tcp # BBS service 223 | # 224 | # 225 | # Kerberos (Project Athena/MIT) services 226 | # Note that these are for Kerberos v4, and are unofficial. Sites running 227 | # v4 should uncomment these and comment out the v5 entries above. 228 | # 229 | kerberos4 750/udp kerberos-iv kdc # Kerberos (server) udp 230 | kerberos4 750/tcp kerberos-iv kdc # Kerberos (server) tcp 231 | kerberos_master 751/udp # Kerberos authentication 232 | kerberos_master 751/tcp # Kerberos authentication 233 | passwd_server 752/udp # Kerberos passwd server 234 | krb_prop 754/tcp # Kerberos slave propagation 235 | krbupdate 760/tcp kreg # Kerberos registration 236 | kpasswd 761/tcp kpwd # Kerberos "passwd" 237 | kpop 1109/tcp # Pop with Kerberos 238 | knetd 2053/tcp # Kerberos de-multiplexor 239 | zephyr-srv 2102/udp # Zephyr server 240 | zephyr-clt 2103/udp # Zephyr serv-hm connection 241 | zephyr-hm 2104/udp # Zephyr hostmanager 242 | eklogin 2105/tcp # Kerberos encrypted rlogin 243 | # 244 | # Unofficial but necessary (for NetBSD) services 245 | # 246 | supfilesrv 871/tcp # SUP server 247 | supfiledbg 1127/tcp # SUP debugging 248 | # 249 | # Datagram Delivery Protocol services 250 | # 251 | rtmp 1/ddp # Routing Table Maintenance Protocol 252 | nbp 2/ddp # Name Binding Protocol 253 | echo 4/ddp # AppleTalk Echo Protocol 254 | zip 6/ddp # Zone Information Protocol 255 | # 256 | # Services added for the Debian GNU/Linux distribution 257 | poppassd 106/tcp # Eudora 258 | poppassd 106/udp # Eudora 259 | mailq 174/tcp # Mailer transport queue for Zmailer 260 | mailq 174/udp # Mailer transport queue for Zmailer 261 | ssmtp 465/tcp # SMTP over SSL 262 | gdomap 538/tcp # GNUstep distributed objects 263 | gdomap 538/udp # GNUstep distributed objects 264 | snews 563/tcp # NNTP over SSL 265 | ssl-ldap 636/tcp # LDAP over SSL 266 | omirr 808/tcp omirrd # online mirror 267 | omirr 808/udp omirrd # online mirror 268 | rsync 873/tcp # rsync 269 | rsync 873/udp # rsync 270 | simap 993/tcp # IMAP over SSL 271 | spop3 995/tcp # POP-3 over SSL 272 | socks 1080/tcp # socks proxy server 273 | socks 1080/udp # socks proxy server 274 | rmtcfg 1236/tcp # Gracilis Packeten remote config server 275 | xtel 1313/tcp # french minitel 276 | support 1529/tcp # GNATS 277 | cfinger 2003/tcp # GNU Finger 278 | ninstall 2150/tcp # ninstall service 279 | ninstall 2150/udp # ninstall service 280 | afbackup 2988/tcp # Afbackup system 281 | afbackup 2988/udp # Afbackup system 282 | icp 3130/tcp # Internet Cache Protocol (Squid) 283 | icp 3130/udp # Internet Cache Protocol (Squid) 284 | postgres 5432/tcp # POSTGRES 285 | postgres 5432/udp # POSTGRES 286 | fax 4557/tcp # FAX transmission service (old) 287 | hylafax 4559/tcp # HylaFAX client-server protocol (new) 288 | noclog 5354/tcp # noclogd with TCP (nocol) 289 | noclog 5354/udp # noclogd with UDP (nocol) 290 | hostmon 5355/tcp # hostmon uses TCP (nocol) 291 | hostmon 5355/udp # hostmon uses TCP (nocol) 292 | ircd 6667/tcp # Internet Relay Chat 293 | ircd 6667/udp # Internet Relay Chat 294 | webcache 8080/tcp # WWW caching service 295 | webcache 8080/udp # WWW caching service 296 | tproxy 8081/tcp # Transparent Proxy 297 | tproxy 8081/udp # Transparent Proxy 298 | mandelspawn 9359/udp mandelbrot # network mandelbrot 299 | amanda 10080/udp # amanda backup services 300 | kamanda 10081/tcp # amanda backup services (Kerberos) 301 | kamanda 10081/udp # amanda backup services (Kerberos) 302 | amandaidx 10082/tcp # amanda backup services 303 | amidxtape 10083/tcp # amanda backup services 304 | isdnlog 20011/tcp # isdn logging system 305 | isdnlog 20011/udp # isdn logging system 306 | vboxd 20012/tcp # voice box system 307 | vboxd 20012/udp # voice box system 308 | binkp 24554/tcp # Binkley 309 | binkp 24554/udp # Binkley 310 | asp 27374/tcp # Address Search Protocol 311 | asp 27374/udp # Address Search Protocol 312 | tfido 60177/tcp # Ifmail 313 | tfido 60177/udp # Ifmail 314 | fido 60179/tcp # Ifmail 315 | fido 60179/udp # Ifmail 316 | 317 | # Local services 318 | 319 | linuxconf 98/tcp 320 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /etc/init.d/tc-config: -------------------------------------------------------------------------------- 1 | #!/bin/busybox 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 | useBusybox 7 | 8 | USER="tc" 9 | TCEDIR="/tmp/tce" 10 | TCEOPT="/tmp/tce/optional" 11 | TCLOOP="/tmp/tcloop" 12 | TCEINSTALLED="/usr/local/tce.installed" 13 | INSTALLED="" 14 | VERSION="$(getFullVer)" 15 | KERNEL="$(uname -r)" 16 | 17 | addUser(){ 18 | echo "${GREEN}Adding user ${YELLOW}$USER ${NORMAL}" 19 | /usr/sbin/adduser -s /bin/sh -G staff -D "$USER" 20 | echo "$USER":tcuser | /usr/sbin/chpasswd -m 21 | echo -e "$USER\tALL=NOPASSWD: ALL" >> /etc/sudoers 22 | } 23 | 24 | ### END functions 25 | 26 | # Main 27 | 28 | echo "${GREEN}Booting ${YELLOW}Core $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 | ntpserver*) NTPSERVER=${i#*=} ;; 44 | icons*) ICONS=${i#*=} ;; 45 | noicons*) NOICONS=${i#*=} ;; 46 | user*) USER=${i#*=} ;; 47 | home*) MYHOME=${i#*=} ;; 48 | tcvd*) TCVD=${i#*=} ;; 49 | opt*) MYOPT=${i#*=} ;; 50 | swapfile*) SWAPFILE=${i#*=} ;; 51 | resume*) RESUME=${i#*=} ;; 52 | host*) HOST=1 ;; 53 | nodhcp* ) NODHCP=${i#*=} ;; 54 | nfsmount* ) NFSMOUNT=${i#*=} ;; 55 | tftplist* ) TFTPLIST=${i#*=} ;; 56 | httplist* ) HTTPLIST=${i#*=} ;; 57 | aoe* ) AOE=${i#*=} ;; 58 | nbd* ) NBD=${i#*=} ;; 59 | mydata* ) MYDATA=${i#*=} ;; 60 | pretce* ) PRETCE=${i#*=} ;; 61 | xvesa* ) XVESA=${i#*=} ;; 62 | rsyslog=* ) RSYSLOG=${i#*=}; SYSLOG=1 ;; 63 | blacklist* ) BLACKLIST="$BLACKLIST ${i#*=}" ;; 64 | iso* ) ISOFILE=${i#*=} ;; 65 | esac 66 | ;; 67 | *) 68 | case $i in 69 | nozswap) NOZSWAP=1 ;; 70 | nofstab) NOFSTAB=1 ;; 71 | nortc) NORTC=1 ;; 72 | syslog) SYSLOG=1 ;; 73 | noutc) NOUTC=1 ;; 74 | nodhcp) NODHCP=1 ;; 75 | noicons) NOICONS=1 ;; 76 | text) TEXT=1 ;; 77 | xonly) XONLY=1 ;; 78 | superuser) SUPERUSER=1 ;; 79 | noswap) NOSWAP=1 ;; 80 | secure) SECURE=1 ;; 81 | protect) PROTECT=1 ;; 82 | cron) CRON=1 ;; 83 | xsetup) XSETUP=1 ;; 84 | laptop) LAPTOP=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 | rotdash $! 111 | echo "${GREEN} Done.${NORMAL}" 112 | 113 | [ -n "$WAITUSB" ] && ( 114 | case $WAITUSB in 115 | *:*) dev=${WAITUSB#*:} 116 | timeout=$((${WAITUSB%:*} * 4)) 117 | while [ $timeout -gt 0 ]; do 118 | echo -en "${BLUE}\rWaiting as requested... ${NORMAL}$(($timeout / 4)) " 119 | timeout=$(($timeout - 1)) 120 | blkid -lt $dev >/dev/null && timeout=0 || sleep 0.25 121 | done 122 | echo 123 | ;; 124 | *) sleep "$WAITUSB" ;; 125 | esac 126 | ) 127 | 128 | modprobe loop 2>/dev/null 129 | #modprobe ohci_hcd 130 | 131 | if [ -n "$NOZSWAP" ]; then 132 | echo "${BLUE}Skipping compressed swap in ram as requested from the boot command line.${NORMAL}" 133 | else 134 | while [ ! -e /dev/zram0 ]; do usleep 50000; done 135 | grep MemFree /proc/meminfo | awk '{printf("%dK\n", $2/4)}' > /sys/block/zram0/disksize 136 | 137 | mkswap /dev/zram0 >/dev/null 2>&1 138 | swapon /dev/zram0 139 | echo "/dev/zram0 swap swap defaults,noauto 0 0" >> /etc/fstab # Lets swapoff -a work 140 | fi 141 | 142 | if [ -n "$NOFSTAB" ]; then 143 | echo "${BLUE}Skipping /etc/fstab creation as requested from the boot command line.${NORMAL}" 144 | else 145 | echo "${BLUE}Scanning hard disk partitions to create ${YELLOW}/etc/fstab ${NORMAL}" 146 | /usr/sbin/rebuildfstab & fstab_pid=$! 147 | mv /tmp/98-tc.rules /etc/udev/rules.d/. 2>/dev/null 148 | /sbin/udevadm control --reload-rules & 149 | fi 150 | 151 | [ -n "$LANGUAGE" ] || LANGUAGE="C" 152 | echo -n "${GREEN}Setting Language to ${MAGENTA}$LANGUAGE" 153 | echo "LANG=$LANGUAGE" > /etc/sysconfig/language 154 | export LANG=$LANGUAGE 155 | echo "${GREEN} Done.${NORMAL}" 156 | 157 | if [ -n "$TZ" ]; then 158 | echo -n "${GREEN}Setting Timezone to ${MAGENTA}$TZ" 159 | export TZ && echo "TZ=$TZ" > /etc/sysconfig/timezone 160 | echo "${GREEN} Done.${NORMAL}" 161 | fi 162 | 163 | if [ -n "$NORTC" ]; then 164 | echo "${BLUE}Skipping rtc as requested from the boot command line.${NORMAL}" 165 | else 166 | while [ ! -e /dev/rtc0 ]; do usleep 50000; done 167 | if [ -n "$NOUTC" ]; then 168 | /sbin/hwclock -l -s & 169 | else 170 | /sbin/hwclock -u -s & 171 | fi 172 | fi 173 | 174 | if [ -n "$HOST" ]; then 175 | sethostname 176 | else 177 | /bin/hostname -F /etc/hostname 178 | fi 179 | 180 | if [ -n "$SYSLOG" ]; then 181 | [ -z "$RSYSLOG" ] || SOPTS=" -R $RSYSLOG -L " 182 | /sbin/syslogd ${SOPTS} && echo "${GREEN}syslog started.${NORMAL}" 183 | /sbin/klogd && echo "${GREEN}klog started." 184 | fi 185 | 186 | /sbin/ifconfig lo 127.0.0.1 up 187 | /sbin/route add 127.0.0.1 lo & 188 | if [ -n "$NODHCP" -a "$(type -t $NODHCP)" == "$NODHCP" ]; then 189 | $NODHCP 190 | fi 191 | 192 | if [ -n "$AOE" ]; then 193 | IFACE=$( echo $AOE | awk -F: '{ print $1 }') 194 | DEV=$( echo $AOE | awk -F: '{ print $2 }') 195 | ifconfig $IFACE up 196 | modprobe aoe 197 | echo "${BLUE}Waiting for $DEV${NORMAL}" 198 | CNT=120 199 | until [ -e /dev/etherd/interfaces ] 200 | do 201 | [ $((--CNT)) -le 0 ] && break 202 | echo -ne "${RED}$CNT \r" 203 | sleep 1 204 | done 205 | printf "%s\0" $IFACE > /dev/etherd/interfaces 206 | echo > /dev/etherd/discover 207 | until [ -e /dev/etherd/$DEV ] 208 | do 209 | [ $((--CNT)) -le 0 ] && break 210 | echo -ne "${RED}$CNT \r" 211 | sleep 1 212 | done 213 | if [ $CNT -gt 0 ] ; then 214 | ln -s /dev/etherd/$DEV /dev/$DEV 215 | mkdir -p /mnt/$DEV 216 | mount /dev/$DEV /mnt/$DEV >/dev/null 2>&1 217 | else 218 | echo -ne "\n$DEV NOT mounted! Press " ; read junk 219 | fi 220 | echo "${NORMAL}" 221 | fi 222 | 223 | # dhcp.sh runs udhcpc async, so it exits before network is up 224 | wait4Server() { 225 | if [ -z "$NODHCP" ]; then 226 | /etc/init.d/dhcp.sh 227 | fi 228 | SERVER=$1 ; NOPING=$2 ; CNT=0 229 | if [ "$NOPING" == "1" ] ; then 230 | until ifconfig | grep -q Bcast 231 | do 232 | [ $((CNT++)) -gt 60 ] && break || sleep 1 233 | done 234 | sleep 1 235 | else 236 | until ping -c 1 $SERVER >/dev/null 2>&1 237 | do 238 | [ $((CNT++)) -gt 60 ] && break || sleep 1 239 | done 240 | fi 241 | DHCP_RAN=1 242 | } 243 | 244 | if [ -n "$USER" ]; then 245 | if ! grep "$USER" /etc/passwd >/dev/null; then addUser; fi 246 | else 247 | USER="tc" 248 | fi 249 | echo "$USER" > /etc/sysconfig/tcuser 250 | mkdir -p /home/"$USER" 251 | 252 | if [ -n "$SUPERUSER" ]; then 253 | touch /etc/sysconfig/superuser 254 | fi 255 | 256 | # Setup base directories for TCE Applicatons 257 | [ -d "$TCEINSTALLED" ] || mkdir "$TCEINSTALLED" 258 | [ -d "$TCEDIR" ] || mkdir "$TCEDIR" 259 | [ -d "$TCEOPT" ] || mkdir "$TCEOPT" 260 | [ -d "$TCLOOP" ] || mkdir "$TCLOOP" 261 | ln -sf "$TCEDIR" /etc/sysconfig/tcedir 262 | chown "$USER" "$TCEOPT" 263 | chgrp staff "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP" 264 | chmod g+w "$TCEDIR" "$TCEOPT" "$TCEINSTALLED" "$TCLOOP" 265 | 266 | chmod u+s /bin/busybox.suid /usr/bin/sudo 267 | 268 | get_app() { 269 | LOADER="tce-load -i" ; PKG=optional 270 | PROTO=$1 271 | HOST=${2%%/*} 272 | REST=${2#*/} 273 | LENG=$((${#HOST}-1)) ; LAST=${HOST:$LENG:1} 274 | [ "$LAST" == ":" ] && HOST=${HOST:0:$LENG} 275 | FILE=${REST%:*} 276 | NAME=${FILE##*/} 277 | OPTS=${REST#*:} 278 | [ "$OPTS" == "no-ping" ] && NOPING=1 || NOPING=0 279 | [ -z "$DHCP_RAN" ] && wait4Server $HOST $NOPING 280 | ( TCE=/tmp/tce/$PKG 281 | cd $TCE 282 | [ "$PROTO" = "TFTP" ] && tftp -g -r $FILE $HOST 283 | [ "$PROTO" = "HTTP" ] && wget -q http://${HOST}/${FILE} 284 | [ $SHOWAPPS ] && echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}" 285 | dos2unix -u $NAME 286 | while read FILE FL 287 | do 288 | APP=${FILE##*/} 289 | [ "$PROTO" = "TFTP" ] && tftp -g -r $FILE $HOST 290 | [ "$PROTO" = "HTTP" ] && wget -q http://${HOST}/${FILE} 291 | [ $SHOWAPPS ] && echo -ne "$APP " 292 | su "$USER" -c "$LOADER $FL $TCE/$APP" 293 | [ "$FL" == "-c" ] && rm $APP 294 | done < $NAME 295 | [ $SHOWAPPS ] && echo "${GREEN} Done.${NORMAL}" 296 | rm $NAME 297 | ) 298 | } 299 | 300 | # Preload drivers needed for tce/opt/home on lvm/RAID etc 301 | if [ -n "$PRETCE" ]; then 302 | PKG=optional ; LOADER="tce-load -i" ; LIST=onboot.lst 303 | RAM=/tmp/tce 304 | CPTOFS="" 305 | if [ "$PRETCE" == "RAM" ] ; then 306 | SRC=$RAM 307 | [ -f $SRC/copy2fs.flg ] && CPTOFS=1 308 | else 309 | PPATH=${PRETCE%%/*} 310 | mkdir -p /mnt/$PPATH 311 | mount /dev/$PPATH /mnt/$PPATH 312 | SRC=/mnt/$PRETCE 313 | [ -x $SRC/onpre.sh ] && cp $SRC/onpre.sh /tmp 314 | [ -f $SRC/copy2fs.flg ] && CPTOFS=1 315 | if [ $CPTOFS ] ; then 316 | cp $SRC/$PKG/* $RAM/$PKG/ 317 | cp $SRC/$LIST $RAM/ 318 | SRC=$RAM 319 | umount /mnt/$PPATH 2>/dev/null 320 | fi 321 | fi 322 | MNT="" 323 | while read NAME OPT 324 | do 325 | [ $CPTOFS ] || grep -q $NAME $SRC/copy2fs.lst 2>/dev/null && FL="-c" || FL='' 326 | [ $FL ] || MNT=1 327 | su "$USER" -c "/usr/bin/$LOADER $SRC/$PKG/$NAME" 328 | [ "$SRC" == "$RAM" ] && [ "$FL" == "-c" ] && rm $RAM/$PKG/$NAME 329 | done < $SRC/$LIST 330 | [ "$SRC" != "$RAM" ] && [ $MNT ] || umount /mnt/$PPATH 2>/dev/null 331 | rm $RAM/copy2fs.flg $RAM/copy2fs.lst 2>/dev/null 332 | [ -x /tmp/onpre.sh ] && /tmp/onpre.sh 333 | fi 334 | 335 | # First process tftp and http entries 336 | modprobe -q squashfs 2>/dev/null 337 | [ -n "$TFTPLIST" ] && get_app "TFTP" $TFTPLIST 338 | [ -n "$HTTPLIST" ] && get_app "HTTP" $HTTPLIST 339 | 340 | if [ -n "$NFSMOUNT" ]; then 341 | NFSPTH="/mnt/nfs" 342 | SERVER=$( echo $NFSMOUNT | awk -F: '{ print $1 }') 343 | DIR=$( echo $NFSMOUNT | awk -F: '{ print $2 }') 344 | OPTS=$( echo $NFSMOUNT | awk -F: '{ print $3 }' | tr "," " " ) 345 | MOUNT=mount; MOUNT4=/usr/local/sbin/mount.nfs4; NOPING=0 346 | echo "${RED}Mounting NFS Server ${YELLOW}${SERVER}:${DIR}${NORMAL}" 347 | set $OPTS END 348 | while [ "$1" != "END" ] 349 | do 350 | case $1 in 351 | no-ping) NOPING=1 ;; 352 | nfs4) [ -x $MOUNT4 ] && MOUNT=$MOUNT4 ;; 353 | *) MYOPTS="${MYOPTS} $1" ;; 354 | esac 355 | shift 356 | done 357 | MYOPTS=$(echo $MYOPTS) # Remove pre/trailing space(s) 358 | MYOPTS=${MYOPTS// /,} # Replace SPACE with COMMA 359 | [ -z "$DHCP_RAN" ] && wait4Server $SERVER $NOPING 360 | wait $fstab_pid 361 | if [ -d $NFSPTH ]; then umount $NFSPTH >/dev/null 2>&1; fi 362 | mkdir -p $NFSPTH 363 | if [ -x /usr/local/etc/init.d/nfs-client ]; then 364 | echo " --> nfs-utils detected" 365 | /usr/local/etc/init.d/nfs-client start 366 | OP=""; if [ ! "${MYOPTS}" == "" ]; then OP="-o $MYOPTS"; fi 367 | if $MOUNT "${SERVER}:${DIR}" $OP $NFSPTH 2>/dev/null; then 368 | FSOP=""; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi 369 | echo "${SERVER}:${DIR} $NFSPTH nfs defaults${FSOP} 0 0" >>/etc/fstab 370 | elif mount "${SERVER}:${DIR}" $OP $NFSPTH 2>/dev/null; then 371 | FSOP=""; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi 372 | echo "${SERVER}:${DIR} $NFSPTH nfs defaults${FSOP} 0 0" >>/etc/fstab 373 | fi 374 | elif 375 | OP="-o nolock"; if [ ! "${MYOPTS}" == "" ]; then OP="-o $MYOPTS"; fi 376 | echo " --> mounting bb-mount with $OP" 377 | mount $OP "${SERVER}:${DIR}" $NFSPTH 2>/dev/null; then 378 | FSOP="nolock"; if [ ! "${MYOPTS}" == "" ]; then FSOP=",${MYOPTS}"; fi 379 | echo "${SERVER}:${DIR} $NFSPTH nfs defaults,${FSOP} 0 0" >>/etc/fstab 380 | else 381 | echo "${RED}Mounting ${SERVER}:${DIR} failed${NORMAL}" 382 | fi 383 | fi 384 | 385 | touch /var/tmp/k5_skip 386 | if [ -n "$NBD" ]; then 387 | modprobe -q nbd 388 | SERVER=$( echo $NBD | awk -F: '{ print $1 }') 389 | PORT=$( echo $NBD | awk -F: '{ print $2 }') 390 | OPTS=$( echo $NBD | awk -F: '{ print $3 }') 391 | [ "$OPTS" == "no-ping" ] && NOPING=1 || NOPING=0 392 | [ -z "$DHCP_RAN" ] && wait4Server $SERVER $NOPING 393 | nbd-client $SERVER $PORT /dev/nbd0 394 | mkdir /mnt/nbd0 395 | mount /dev/nbd0 /mnt/nbd0 2>&1 396 | pidof nbd-client nbd0 >> /var/tmp/k5_skip 397 | fi 398 | 399 | if grep -q "^/dev/root" /proc/mounts; then 400 | INSTALLED=1 401 | echo "${RED}Detected Traditional Hard drive installation.${NORMAL}" 402 | fi 403 | 404 | /sbin/ldconfig 2>/dev/null 405 | 406 | [ -n "$TEXT" ] && touch /etc/sysconfig/text 407 | [ -n "$XONLY" ] && touch /etc/sysconfig/xonly 408 | 409 | #Check for Virtual Hard Drive 410 | if [ -n "$TCVD" ]; then 411 | wait $fstab_pid 412 | TCVD="${TCVD#/}" 413 | TCVD="${TCVD#dev/}" 414 | TCVD_DEVICE="${TCVD%%/*}" 415 | TCVD_LOOPFILE="${TCVD#*/}" 416 | if [ "$TCVD_DEVICE" == "$TCVD_LOOPFILE" ]; then 417 | TCVD_DEVICE="$(tc_autoscan $TCVD_LOOPFILE 'f')" 418 | fi 419 | PARTITION="${TCVD_DEVICE##/dev/}" 420 | find_mountpoint "$PARTITION" 421 | if [ -n "$MOUNTPOINT" ]; then 422 | [ "$MOUNTED" == "yes" ] || /bin/mount "$MOUNTPOINT" 423 | usleep_progress 424 | if [ -f "$MOUNTPOINT"/"$TCVD_LOOPFILE" ]; then 425 | [ -d /mnt/tcvd ] || /bin/mkdir /mnt/tcvd 426 | ln -sf "$MOUNTPOINT"/"$TCVD_LOOPFILE" /dev/tcvd 427 | printf "/dev/tcvd \t/mnt/tcvd \text2\tloop\t0 0 #Added by TC\n" >> /etc/fstab 428 | sync 429 | fi 430 | fi 431 | fi 432 | 433 | if [ -n "$MYHOME" ]; then 434 | wait $fstab_pid 435 | PARTITION=${MYHOME##/dev/} 436 | find_mountpoint "$PARTITION" 437 | if [ -n "$MOUNTPOINT" ]; then 438 | [ "$MOUNTED" == "yes" ] || mount "$MOUNTPOINT" 439 | 440 | MS_MNTS=`mount|awk '$5~/fat|vfat|msdos|ntfs/{printf "%s ",$3}'` 441 | case "$MS_MNTS" in 442 | *"$MOUNTPOINT"* ) 443 | echo "Persistent HOME not supported on Microsoft File Systems." 444 | echo "${YELLOW}Request for persistent HOME on $PARTITION ignored." 445 | echo -n "${RED}Press Enter key.${NORMAL}"; read ans 446 | ;; 447 | * ) 448 | if [ -d "$MOUNTPOINT/home/$USER" ]; then 449 | mount --bind "$MOUNTPOINT/home" /home 450 | else 451 | mkdir -p "$MOUNTPOINT/home/$USER" 452 | mount --bind "$MOUNTPOINT/home" /home 453 | fi 454 | ;; 455 | esac 456 | 457 | else 458 | echo "Invalid device specified. Ignoring persistent HOME request!" 459 | fi 460 | fi 461 | 462 | setupHome 463 | 464 | unset OPT_SETUP 465 | if [ -n "$MYOPT" ]; then 466 | wait $fstab_pid 467 | PARTITION=${MYOPT##/dev/} 468 | find_mountpoint "$PARTITION" 469 | if [ -n "$MOUNTPOINT" ]; then 470 | [ "$MOUNTED" == "yes" ] || mount "$MOUNTPOINT" 471 | 472 | MS_MNTS=`mount|awk '$5~/fat|vfat|msdos|ntfs/{printf "%s ",$3}'` 473 | case "$MS_MNTS" in 474 | *"$MOUNTPOINT"* ) 475 | echo "Persistent OPT not supported on Microsoft File Systems." 476 | echo "${YELLOW}Request for persistent OPT on $PARTITION ignored." 477 | echo -n "${RED}Press Enter key.${NORMAL}"; read ans 478 | ;; 479 | * ) 480 | [ -d "$MOUNTPOINT"/opt ] || mkdir "$MOUNTPOINT"/opt 481 | yes n | cp -ai /opt/* /opt/.[!.]* "$MOUNTPOINT"/opt/ 2>/dev/null 482 | mount --bind "$MOUNTPOINT"/opt/ /opt/ 483 | # adjust the /opt directory itself: 484 | chgrp staff /opt >/dev/null 2>&1 485 | chmod g+w /opt >/dev/null 2>&1 486 | chmod g+s /opt >/dev/null 2>&1 487 | # inside /opt, adjust only system files: 488 | for system_file in backgrounds .filetool.lst .xfiletool.lst bootlocal.sh bootsync.sh shutdown.sh tcemirror; do 489 | chgrp -R staff /opt/"$system_file" >/dev/null 2>&1 490 | chmod -R g+w /opt/"$system_file" >/dev/null 2>&1 491 | chmod g+s /opt/"$system_file" >/dev/null 2>&1 492 | done 493 | ;; 494 | esac 495 | 496 | else 497 | echo "Invalid device specified. Skipping persistent OPT request!" 498 | fi 499 | fi 500 | 501 | [ -n "$XSETUP" ] && touch /tmp/xsetup_requested 502 | 503 | if [ -n "$LAPTOP" ]; then 504 | modprobe ac && modprobe battery 2>/dev/null 505 | modprobe yenta_socket >/dev/null 2>&1 || modprobe i82365 >/dev/null 2>&1 506 | /sbin/udevadm trigger 2>/dev/null >/dev/null & 507 | echo "${GREEN}Laptop options enabled (AC, Battery and PCMCIA).${NORMAL}" 508 | fi 509 | 510 | if [ -n "$NOSWAP" ]; then 511 | echo "${BLUE}Ignoring swap partition(s) seek as requested.${NORMAL}" 512 | else 513 | wait $fstab_pid 514 | /sbin/swapon -a 2>/dev/null 515 | if [ "$?" == 0 ]; then echo "${GREEN}Possible swap partition(s) enabled.${NORMAL}"; fi 516 | fi 517 | 518 | if [ -n "$SWAPFILE" ]; then 519 | wait $fstab_pid 520 | SWAPFILE=${SWAPFILE##/dev/} 521 | find_mountpoint "$SWAPFILE" 522 | if [ -n "$MOUNTPOINT" ]; then 523 | if [ "$MOUNTED" == "yes" ]; then 524 | swapon "$MOUNTPOINT"/tc.swp 525 | else 526 | mount "$MOUNTPOINT" && swapon "$MOUNTPOINT"/tc.swp 527 | fi 528 | fi 529 | fi 530 | 531 | if [ -n "$RESUME" ]; then 532 | rm -f /etc/sysconfig/tc.resume 2>/dev/null 533 | RESUME=`basename $RESUME` 534 | SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}') 535 | [ -z "$SWAP_SIZE" ] && /sbin/swapon /dev/"$RESUME" && SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}') 536 | [ -z "$SWAP_SIZE" ] && exit 1 537 | MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}') 538 | if [ $SWAP_SIZE -gt $MEM_SIZE ]; then 539 | grep -q disk /sys/power/state && echo "disk" > /etc/sysconfig/tc.resume 540 | fi 541 | fi 542 | 543 | if [ "$NOICONS" == 1 ]; then 544 | > /etc/sysconfig/icons 545 | else 546 | # If icon manager is specified use that 547 | if [ -n "$ICONS" ]; then 548 | echo "$ICONS" > /etc/sysconfig/icons 549 | else 550 | [ -s /etc/sysconfig/icons ] && ICONS=`cat /etc/sysconfig/icons` 551 | fi 552 | fi 553 | [ "$NOICONS" == "ondemand" ] && touch /etc/sysconfig/noondemandicons 554 | sync 555 | 556 | wait $fstab_pid 557 | MSSG="${BLUE}Loading extensions...${NORMAL}" 558 | if [ -n "$SHOWAPPS" ]; then 559 | touch /etc/sysconfig/showapps 560 | echo "$MSSG" 561 | /usr/bin/tce-setup "booting" 562 | [ -n "$ISOFILE" ] && /usr/bin/fromISOfile "$ISOFILE" 563 | rm /etc/sysconfig/showapps 564 | echo "${GREEN} Done.${NORMAL}" 565 | else 566 | echo -n "$MSSG" 567 | /usr/bin/tce-setup "booting" > /dev/null 2>&1 & 568 | rotdash $! 569 | [ -n "$ISOFILE" ] && /usr/bin/fromISOfile "$ISOFILE" > /dev/null 2>&1 & 570 | rotdash $! 571 | echo "${GREEN} Done.${NORMAL}" 572 | if [ -s /tmp/aberr ]; then 573 | echo "${RED}Warning! Errors occured during the loading of the extensions.${YELLOW}" 574 | cat /tmp/aberr 575 | echo -n "${RED}Press Enter key.${NORMAL}"; read ans 576 | fi 577 | fi 578 | 579 | [ -n "$KEYMAP" ] || KEYMAP="us" 580 | if [ -f "/usr/share/kmap/$KEYMAP.kmap" ]; then 581 | echo -n "${GREEN}Setting keymap to ${MAGENTA}$KEYMAP" 582 | /sbin/loadkmap < /usr/share/kmap/$KEYMAP.kmap 583 | echo "KEYMAP=$KEYMAP" > /etc/sysconfig/keymap 584 | echo "${GREEN} Done.${NORMAL}" 585 | fi 586 | 587 | if [ -n "$SECURE" ]; then 588 | getpasswd "root" 589 | echo "root:$PASSWD" | chpasswd -m 590 | getpasswd "$USER" 591 | echo "$USER:$PASSWD" | chpasswd -m 592 | fi 593 | if [ -n "$PROTECT" ]; then 594 | getpasswd "encryption" 595 | echo "$PASSWD" > /etc/sysconfig/bfe 596 | chown ${USER}:root /etc/sysconfig/bfe 597 | chmod 600 /etc/sysconfig/bfe 598 | fi 599 | 600 | [ -n "$XVESA" ] && sed -i 's/1024x768x32/'"$XVESA"'/' /home/"$USER"/.xsession 2>/dev/null 601 | 602 | # If desktop is specified use that 603 | if [ -n "$DESKTOP" ]; then 604 | echo "$DESKTOP" > /etc/sysconfig/desktop 605 | else 606 | [ -s /etc/sysconfig/desktop ] && DESKTOP=`cat /etc/sysconfig/desktop` 607 | fi 608 | 609 | # If ntpserver is specified use that 610 | if [ -n "$NTPSERVER" ]; then 611 | echo "$NTPSERVER" > /etc/sysconfig/ntpserver 612 | else 613 | [ -s /etc/sysconfig/ntpserver ] && NTPSERVER=`cat /etc/sysconfig/ntpserver` 614 | fi 615 | 616 | # If restore then also pass TCE directory for quick look of mydata.tgz backupfile 617 | if [ -n "$MYDATA" ]; then 618 | echo "$MYDATA" > /etc/sysconfig/mydata 619 | else 620 | echo "mydata" > /etc/sysconfig/mydata 621 | fi 622 | if [ -n "$NORESTORE" ]; then 623 | echo "${GREEN}Skipping restore as requested from the command line.${NORMAL}" 624 | else 625 | TCEDIR=`readlink /etc/sysconfig/tcedir` 626 | /etc/init.d/tc-restore.sh "$TCEDIR" 627 | fi 628 | 629 | # After restore items 630 | if [ -n "$NODHCP" ]; then 631 | echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}" 632 | else 633 | [ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh & 634 | [ -z "$NORTC" ] || /etc/init.d/settime.sh & 635 | fi 636 | 637 | [ -n "$CRON" ] && /etc/init.d/services/crond start 638 | 639 | /sbin/loadcpufreq 2>/dev/null & 640 | 641 | /opt/bootsync.sh 642 | 643 | [ -n "$NOAUTOLOGIN" ] && echo "booting" > /etc/sysconfig/noautologin 644 | 645 | if [ -n "$PAUSE" ]; then 646 | echo -n "${BLUE}Boot time configuration completed. Press to continue.${NORMAL}" 647 | read junk 648 | fi 649 | 650 | --------------------------------------------------------------------------------