1
0
mirror of https://gitlab.alpinelinux.org/alpine/alpine-baselayout.git synced 2025-04-19 09:42:19 +03:00

initial import based on 1.0.1

This commit is contained in:
ncopa 2006-10-24 12:26:42 +00:00
commit c8b95b81b6
65 changed files with 4477 additions and 0 deletions

92
Makefile Normal file
View File

@ -0,0 +1,92 @@
VERSION=1.0.1
PV = alpine-baselayout-$(VERSION)
TARBALL = $(PV).tar.gz
SUBDIRS = src init.d
GENERATED_FILES = TZ hosts profile
ETC_FILES = $(GENERATED_FILES) group fstab inittab nsswitch.conf passwd protocols services shadow shells issue mdev.conf crontab sysctl.conf
CONFD_FILES = $(addprefix conf.d/, bridge cron localinit tuntap watchdog)
SBIN_FILES = runscript-alpine.sh functions.sh rc_add rc_delete rc_status
RC_SH_FILES = rc-services.sh
UDHCPC_FILES = default.script
LIB_MDEV_FILES = ide_links sd_links subdir_dev usbdev
CRONTABS = crontab
DISTFILES = $(ETC_FILES) $(SBIN_FILES) $(UDHCPC_FILES) $(RC_SH_FILES) $(LIB_MDEV_FILES) Makefile
all: $(GENERATED_FILES)
for i in $(SUBDIRS) ; do \
cd $$i && make && cd .. ; \
done
clean:
for i in $(SUBDIRS) ; do \
cd $$i && make clean && cd .. ; \
done
rm -f $(TARBALL) $(GENERATED_FILES) *~
TZ:
echo "UTC" > TZ
hostname:
echo localhost > hostname
hosts:
echo -e "127.0.0.1\tlocalhost" > hosts
profile:
echo "export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" > profile
echo "umask 022" >> profile
shadow: passwd
@lastchange=$$(( `date +%s` / ( 24 * 3600 ) ));\
awk -F: ' { \
pw = ":!:";\
if ($$1 == "root") { pw = "::" };\
print $$1 pw "'"$$lastchange"':0:::::" \
}' passwd > $@
# ":" $$pw ":"'"$$lastchange"'":0:::::"
install:
install -m 0755 -d $(addprefix $(DESTDIR)/, etc sbin) \
$(DESTDIR)/etc/conf.d \
$(DESTDIR)/etc/crontabs \
$(DESTDIR)/lib/rcscripts/sh \
$(DESTDIR)/usr/share/udhcpc \
$(DESTDIR)/lib/mdev \
$(DESTDIR)/var/spool/cron \
$(DESTDIR)/etc/periodic/15min \
$(DESTDIR)/etc/periodic/hourly \
$(DESTDIR)/etc/periodic/daily \
$(DESTDIR)/etc/periodic/weekly \
$(DESTDIR)/etc/periodic/monthly
for i in $(SUBDIRS) ; do \
cd $$i && make install && cd .. ;\
done
install -m 0644 $(ETC_FILES) $(DESTDIR)/etc
chmod 600 $(DESTDIR)/etc/shadow
install -m 0644 $(CONFD_FILES) $(DESTDIR)/etc/conf.d
install -m 0755 $(SBIN_FILES) $(DESTDIR)/sbin
install -m 0755 $(UDHCPC_FILES) $(DESTDIR)/usr/share/udhcpc
install -m 0755 $(RC_SH_FILES) $(DESTDIR)/lib/rcscripts/sh
install -m 0755 $(LIB_MDEV_FILES) $(DESTDIR)/lib/mdev
mv $(DESTDIR)/etc/crontab $(DESTDIR)/etc/crontabs/root
ln -s /etc/crontabs $(DESTDIR)/var/spool/cron/crontabs
$(TARBALL): $(DISTFILES) $(SUBDIRS)
rm -rf $(PV)
mkdir $(PV)
for i in $(SUBDIRS) ; do \
cd $$i && make clean && cd .. ; \
done
cp $(DISTFILES) $(PV)
mkdir $(PV)/conf.d
cp $(CONFD_FILES) $(PV)/conf.d/
rsync -Cr $(SUBDIRS) $(PV)
tar --exclude=.svn -czf $@ $(PV)
rm -r $(PV)
dist: $(TARBALL)
.PHONY: install clean all

1
TZ Normal file
View File

@ -0,0 +1 @@
UTC

5
conf.d/bridge Normal file
View File

@ -0,0 +1,5 @@
# Specify bridges here, separated with spaces.
# a every bridge is specified as:
# bridgename=interface1+interface2[+...]
#BRIDGES="br0=eth0+tap0 br1=eth1+eth2"

3
conf.d/cron Normal file
View File

@ -0,0 +1,3 @@
# enter the cron options
CRON_OPTS="-c /etc/crontabs"

3
conf.d/localinit Normal file
View File

@ -0,0 +1,3 @@
# look only for localinit in those dirs.
# set to "" to disable localinit
MOUNTS="usb floppy cdrom"

3
conf.d/tuntap Normal file
View File

@ -0,0 +1,3 @@
# Specify all tap devices
#DEVICES="tap0 tap1"

3
conf.d/watchdog Normal file
View File

@ -0,0 +1,3 @@
#WATCHDOG_OPTS="-t 30"
WATCHDOG_DEV=""

8
crontab Normal file
View File

@ -0,0 +1,8 @@
# do daily/weekly/monthly maintenance
# min hour day month weekday command
*/4 * * * * run-parts /etc/periodic/15min
0 * * * * run-parts /etc/periodic/hourly
0 2 * * * run-parts /etc/periodic/daily
0 3 * * 6 run-parts /etc/periodic/weekly
0 5 1 * * run-parts /etc/periodic/monthly

41
default.script Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
metric=0
for i in $router ; do
route add default gw $i dev $interface metric $metric
metric=$(( $metric + 1 ))
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0

9
fstab Normal file
View File

@ -0,0 +1,9 @@
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
mdev /dev tmpfs size=100k 0 0
none /dev/pts devpts defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/dev/cdrom /media/cdrom iso9660 ro 0 0
/dev/fd0 /media/floppy vfat noauto 0 0
/dev/usba1 /media/usb vfat noauto 0 0
none /proc/bus/usb usbfs noauto 0 0

96
functions.sh Normal file
View File

@ -0,0 +1,96 @@
RC_GOT_FUNCTIONS="yes"
# load user settings
[ -r /etc/conf.d/rc ] && . /etc/conf.d/rc
svclib="/lib/rcscripts"
svcdir="${svcdir:-/var/lib/init.d}"
# void import_addon(char *Addon)
import_addon() {
local addon="$svclib/addons/$1"
[ -r "$addon" ] && . "$addon"
}
echon () {
if [ -z "$ECHON" ]; then
# Determine how to "echo" without newline: "echo -n"
# or "echo ...\c"
if [ "X`echo -n`" = "X-n" ]; then
ECHON=echo
NNL="\c"
# "
else
ECHON="echo -n"
NNL=""
fi
fi
$ECHON "$*$NNL"
}
eerror() {
echo $* >&2
}
einfo() {
echo $* >&2
}
einfon() {
echon $* >&2
}
ewarn() {
echo $* >&2
}
ebegin() {
echon " * $*: "
}
eend() {
local msg
if [ "$1" = 0 ] || [ $# -lt 1 ] ; then
msg="ok."
else
shift
msg=" failed. $*"
fi
echo "$msg"
}
eindent() {
true
}
start_addon() {
(import_addon "$1-start.sh")
return 0
}
stop_addon() {
(import_addon "$1-stop.sh")
return 0
}
save_options() {
local myopts="$1"
mkdir -p -m 0755 "$svcdir/options/$SVCNAME"
shift
echo "$*" > "$svcdir/options/$SVCNAME/$myopts"
}
get_options() {
local svc="$SVCNAME"
[ "$2" ] && svc="$2"
cat "$svcdir/options/$svc/$1" 2>/dev/null
}
die() {
eerror "$1"
exit 1
}

49
group Normal file
View File

@ -0,0 +1,49 @@
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root,adm
lp:x:7:lp
mem:x:8:
kmem:x:9:
wheel:x:10:root
floppy:x:11:root
mail:x:12:mail
news:x:13:news
uucp:x:14:uucp
man:x:15:man
cron:x:16:cron
console:x:17:
audio:x:18:
cdrom:x:19:
dialout:x:20:root
ftp:x:21:
sshd:x:22:
at:x:25:at
tape:x:26:root
video:x:27:root
squid:x:31:squid
gdm:x:32:gdm
xfs:x:33:xfs
games:x:35:
named:x:40:named
mysql:x:60:
postgres:x:70:
cdrw:x:80:
apache:x:81:
nut:x:84:
usb:x:85:
vpopmail:x:89:
users:x:100:games
nofiles:x:200:
qmail:x:201:
postfix:x:207:
postdrop:x:208:
smmsp:x:209:smmsp
slocate:x:245:
portage:x:250:portage
utmp:x:406:
nogroup:x:65533:
nobody:x:65534:

1
hosts Normal file
View File

@ -0,0 +1 @@
127.0.0.1 localhost

23
ide_links Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
[ -f /proc/ide/$MDEV/media ] || exit
media=`cat /proc/ide/$MDEV/media`
for i in $media $media[0-9]* ; do
if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
LINK=$i
break
fi
done
# link exist, remove if necessary and exit
if [ "$LINK" ] ; then
[ "$ACTION" = remove ] && rm $LINK
exit
fi
# create a link
num=`ls $media[0-9]* 2>/dev/null | wc -l`
ln -sf $MDEV "$media`echo $num`"
[ -e "$media" ] || ln -sf $MDEV "$media"

40
init.d/Makefile Normal file
View File

@ -0,0 +1,40 @@
SCRIPTS = alpinecfg.sh \
bootmisc.sh \
bridge \
checkroot.sh \
coldplug \
cron \
hostname \
hwclock \
hwdrivers \
inetd \
localinit \
mdev \
modutils \
mountall \
networking \
procps \
rcK \
rcL \
rcS \
runtimes \
syslog \
tuntap \
udev \
udhcpc \
watchdog
all:
install: $(SCRIPTS)
install -m 0755 -d $(DESTDIR)/etc
install -m 0755 -d $(DESTDIR)/etc/init.d
for i in $(SCRIPTS) ; do \
install -m 755 -D $$i $(DESTDIR)/etc/init.d/$$i ;\
done
clean:
rm -f *~
.PHONY: all clean

44
init.d/alpinecfg.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/busybox sh
# the purpose of this script is to find and import the alpine config.
# load it or set default values.
#depracated
echo "remeber to remove this $0 file..."
exit
get_boot_var () {
# Look for CFG_MEDIA in cmdline
for i in `cat /proc/cmdline` ; do
# if echo $i | grep $ > /dev/null ; then
# echo $i | sed 's/'$1'=//'
# fi
case $i in
$1=*) echo $i | sed 's|'$1'=||' ;;
esac
done
}
import_config() {
if mount $1 ; then
echo "Using Alpine config from $1"
cp $1/$2 /etc/alpine.conf
sleep 1
umount $1
fi
}
CFG="alpine.conf"
CFG_MEDIA=`get_boot_var cfg_media`
#if [ -z "$CFG_MEDIA" ] ; then
# cfg_media was not set in cmdline. We use the defaults...
echo "looking for alpine.conf on default locations"
for i in /media/* ; do
import_config $i $CFG
done
#else
# Only import for specified location
# import_config "/media/$CFG_MEDIA" $CFG
#fi

7
init.d/bootmisc.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
#
# Save kernel messages in /var/log/dmesg
#
dmesg -s 65536 > /var/log/dmesg

38
init.d/bridge Executable file
View File

@ -0,0 +1,38 @@
#!/sbin/runscript
BRCTL=`which brctl 2>/dev/null`
start() {
# abort if brctl does not exist
for brspec in $BRIDGES; do
retcode=0
br=`echo $brspec | cut -d= -f1`
ebegin "Setting up bridge $br"
if [ -z "$BRCTL" ] ; then
eerror "Need bridge-utils to be able to set up $br"
retcode=1
else
brctl addbr $br || retcode=1
bridge_ifs=`echo "$BRIDGES" | sed 's/.*=//; s/\+/ /g'`
for iface in $bridge_ifs ; do
# set if in promisc mode
ifconfig $iface 0.0.0.0 promisc up || retcode=1
brctl addif $br $iface || retcode=1
done
fi
eend $retcode
done
}
stop() {
which brctl > /dev/null 2>&1 || return 1
for brspec in $BRIDGES; do
br=`echo $brspec | cut -d= -f1`
ebegin "Shutting down bridge $br"
brctl delbr $br
eend $?
done
}

46
init.d/checkroot.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
rootmode=rw
rootopts=rw
rootcheck=yes
udevfs=
# read the fstab
sed 's/#.*//' /etc/fstab | while read fs mnt type opts dump pass junk
do
[ "$type" = udevfs ] && udefs="$fs"
[ "$mnt" != / ] && continue
rootopts="$opts"
[ "$pass" = 0 -o "$pass" = "" ] && rootcheck=no
case "$opts" in
ro|ro,*|*,ro|*,ro,*)
rootmode=ro
;;
esac
done
if [ "$rootcheck" = yes ] ; then
if grep "^$fs" /proc/mounts ; then
echo "$fs is mounted. Something is wrong. Please fix and reboot."
echo "sorry newbies..."
echo
echo "CONTROL-D will exit from this shell and reboot the system."
echo
/sbin/sulogin $CONSOLE
reboot -f
elif ! fsck -C "$fs" ; then
echo "fsck failed. Please repair manually and reboot. Please note"
echo "that the root file system is currently mounted read-only. To"
echo "remount it read-write:"
echo
echo " # mount -n -o remount,rw /"
echo
echo "CONTROL-D will exit from this shell and REBOOT the system."
echo
/sbin/sulogin $CONSOLE
reboot -f
fi
fi
mount -o remount,$rootmode /

66
init.d/coldplug Executable file
View File

@ -0,0 +1,66 @@
#!/sbin/runscript
trigger_uevents() {
local i
for i in /sys/bus/*/devices/*/uevent\
/sys/class/*/*/uevent\
/sys/block/*/uevent\
/sys/block/*/*/uevent ; do
case "$i" in
*/device/uevent)
continue
;;
*/class/mem/*|*/class/tty/*)
echo add > "$i"
;;
*/block/md*|*/block/dm-*)
last="$last $i"
;;
*/*)
default="$default $i"
;;
esac
done
for i in $default $last ; do
echo add > "$i"
done
}
# coldplug devices
start() {
unset NOCOLDPLUG
# check for boot option "nocoldplug"
for i in `cat /proc/cmdline`; do
[ "$i" = "nocoldplug" ] && NOCOLDPLUG=true
done
if [ "$NOCOLDPLUG" ]; then
ebegin "Skipping coldplugging"
eend 0
return
fi
# for rc in /etc/hotplug/*.rc ; do
# name=`basename $rc .rc`
# ebegin "Coldplugging $name devices"
# $rc start 2>/tmp/coldplug.err
# eend 0
# done
ebegin "Coldplugging devices"
# while [ -d /dev/.udev/queue ] ; do
# sleep 1
# echo -n "."
# done
# trigger_uevents
# sleep 1
# while [ -d /dev/.udev/queue ] ; do
# sleep 1
# echo -n "."
# done
find /sys -name modalias | while read a ; do
modprobe `cat $a` 2>/dev/null || echo $a >> /tmp/failed
done
eend 0
}

13
init.d/cron Executable file
View File

@ -0,0 +1,13 @@
#!/sbin/runscript
start() {
ebegin "Starting cron"
crond $CRON_OPTS
eend $?
}
stop () {
ebegin "Stopping cron"
killall crond
eend $?
}

9
init.d/hostname Executable file
View File

@ -0,0 +1,9 @@
#!/sbin/runscript
start() {
if [ -f /etc/hostname ] ; then
ebegin "Setting hostname"
hostname -F /etc/hostname
eend $?
fi
}

9
init.d/hwclock Executable file
View File

@ -0,0 +1,9 @@
#!/sbin/runscript
start() {
ebegin "Setting system time from hardware clock"
modprobe rtc 2>/dev/null
#set the system time from hardware clock
/sbin/hwclock -s -u
eend $?
}

48
init.d/hwdrivers Executable file
View File

@ -0,0 +1,48 @@
#!/sbin/runscript
SEC=`date +%s`
# echo a . every second
timer_dots() {
local newsec=`date +%s`
if [ "$SEC" != "$newsec" ] ; then
echo -n '.'
SEC=$newsec
fi
}
# Load hardware drivers
start() {
# check for boot option "nocoldplug"
for i in `cat /proc/cmdline`; do
case $i in
modules=*)
MODULES="`echo ${i#modules=} | tr ',' ' '`";;
noautodetect)
AUTODETECT=no;;
esac
done
if [ "$MODULES" ] || [ "$AUTODETECT" != no ] ; then
ebegin "Loading hardware drivers"
else
ebegin "Skipping hardware drivers"
eend
return
fi
[ "$MODULES" ] && modprobe $MODULES 2> /dev/null
timer_dots
if [ "$AUTODETECT" != no ] ; then
find /sys -name modalias | while read a ; do
modprobe `cat $a` 2>/dev/null || \
echo $a >> /tmp/hwdrivers.failed
timer_dots
done
fi
eend 0
}

13
init.d/inetd Executable file
View File

@ -0,0 +1,13 @@
#!/sbin/runscript
start() {
ebegin "Starting inetd"
inetd $INETD_OPTS
eend $?
}
stop () {
ebegin "Stopping inetd"
killall inetd
eend $?
}

31
init.d/localinit Executable file
View File

@ -0,0 +1,31 @@
#!/sbin/runscript
mount_once() {
if mount | grep $1 >/dev/null 2>&1 ; then
NOUMOUNT=$1
else
mount $1 >/dev/null 2>&1
fi
}
umount_once() {
[ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
}
start() {
for media in $MOUNTS ; do
m="/media/$media"
mount_once $m
if [ -e $m/localinit ] ; then
ebegin "Running localinit from $media"
$m/localinit
retcode=$?
umount_once $m
eend $retcode
exit
fi
sleep 1
umount_once $m
done
}

37
init.d/mdev Executable file
View File

@ -0,0 +1,37 @@
#!/sbin/runscript
start() {
# check if udev is specified on cmd line
for i in `cat /proc/cmdline`; do
[ "$i" = "udev" ] && return 0
done
ebegin "Starting mdev"
mkdir -p /dev
# start mdev
mount /dev
mknod -m 666 /dev/null c 1 3
# use mdev for hotplug
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
# create devices
mdev -s
RC=$?
# create pts file system
[ -d /dev/pts ] || mkdir -m 755 /dev/pts
[ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
mount /dev/pts
[ -d /dev/shm ] || mkdir /dev/shm
mount /dev/shm
eend $RC
}
stop() {
ebegin "Stopping mdev"
echo "" > /proc/sys/kernel/hotplug
umount /dev/pts && umount /dev/shm && umount /dev
eend
}

21
init.d/modutils Executable file
View File

@ -0,0 +1,21 @@
#!/sbin/runscript
PATH="/sbin:/bin:/usr/bin:/usr/bin"
start() {
#[ -e /sbin/depmod ] || exit 0
#echo -n "Calculating module dependencies... "
#depmod -a > /dev/null
#echo "done."
if [ -f /etc/modules ] ; then
sed 's/\#.*//g' < /etc/modules |
while read module args
do
ebegin "Loading $module"
modprobe -q $module $args
eend $?
done
fi
}

8
init.d/mountall Normal file
View File

@ -0,0 +1,8 @@
#!/sbin/runscript
start() {
ebegin "Mounting local filesystems"
mount -a -t nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noocfs2,nogfs 2>&1 >/tmp/mountdebug
eend $?
}

23
init.d/networking Executable file
View File

@ -0,0 +1,23 @@
#!/sbin/runscript
# note that the spoofprotect, syncoockies and ip_forward options are set in
# /etc/sysctl.conf
start() {
ebegin "Configuring network interfaces"
ifup -a
eend $?
}
stop() {
ebegin "Deconfiguring network interfaces"
ifdown -a
eend $?
}
restart() {
ebegin "Reconfiguring network interfaces"
ifdown -a && ifup -a
eend $?
}

10
init.d/procps Executable file
View File

@ -0,0 +1,10 @@
#!/sbin/runscript
start() {
if [ -r /etc/sysctl.conf ] ; then
ebegin "Setting kernel variables"
/sbin/sysctl -p /etc/sysctl.conf >/dev/null
eend $?
fi
}

10
init.d/rcK Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
echo ""
for i in `for j in /etc/rcK.d/K* ; do echo $j ; done | sort -r` ; do
[ -f $i ] && $i stop
done
exit 0

16
init.d/rcL Executable file
View File

@ -0,0 +1,16 @@
#!/bin/busybox sh
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
for i in `seq 0 9` ; do
# first stopp all the K?? scripts in this level
for j in /etc/rcL.d/K$i[0-9]* ; do
[ -f $j ] && $j stop
done
# start all S?? scripts in this level
for j in /etc/rcL.d/S$i[0-9]* ; do
[ -f $j ] && $j start
done
done
exit 0

59
init.d/rcS Executable file
View File

@ -0,0 +1,59 @@
#!/bin/busybox sh
# we need the proc to be able to install busybox
/bin/busybox mkdir -p /proc /usr/sbin /sys
/bin/busybox mount -t proc proc /proc
/bin/busybox mount -t sysfs none /sys
# install busybox links
/bin/busybox --install -s
[ -f /etc/alpine-release ] && read RELEASE BUILD < /etc/alpine-release
echo "Starting $RELEASE"
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# use dash if it exists
[ -x /bin/dash ] && ln -sf /bin/dash /bin/sh
# define some default variables
export DEFAULT_CFG_MOUNTS="/media/cdrom /media/floppy /media/usb"
export DEFAULT_ALPINE_CONF="/alpine.conf"
export DEFAULT_ALPINE_PACKAGES="/packages.conf"
export DEFAULT_PKG_PATH="cdrom://apks"
# start an rc script. Look if there are a no<service> in /proc/cmdline
start_script() {
local n
if [ -f $1 ] ; then
for n in `cat /proc/cmdline`; do
[ "$n" = "s" ] && SINGLEMODE=yes
case $1 in
S??no$n) return 1;;
esac
done
case $1 in
*.sh) . $1 start;;
*) $1 start;;
esac
fi
}
# hide kernel messages
dmesg -n 1
for i in `cat /proc/cmdline` ;do
case $i in
1|s|single)
echo "Entering single mode. Type 'exit' to continue booting."
sh
;;
esac
done
# Run all /etc/rcS.d scripts
for j in /etc/rcS.d/S* ; do
start_script $j
done
exit 0

109
init.d/runtimes Executable file
View File

@ -0,0 +1,109 @@
#!/sbin/runscript
# The purpose of this script is to load the Alpine runtime modules and the
# local config that belongs to.
SFIC=`which sfic 2>/dev/null`
COMMITED_TDB=/var/lib/apk/commited.tdb
# search for a kernel argument
get_karg () {
for i in `cat /proc/cmdline` ; do
case $i in
$1=*) echo $i | sed 's|'$1'=||' ;;
esac
done
}
get_pkg_list() {
# we skip lines that start with '#'
grep -v '^#' $1 | while read pkg ; do
for i in $pkg ; do
echo -n "$pkg "
done
done
}
# load packages from mounted media
load_pkgs_and_config() {
# params:
# $1 = path to mounted media
# $2 =
local apk_list mnt ovl allpkgs pkg
mnt=$1
apk_list="$mnt/packages.list"
if [ -f "$apk_list" ] ; then
echo "
Loading packages from $apk_list:"
apk_fetch -u -q
for pkg in `get_pkg_list $apk_list` ; do
apk_add -q $pkg
echo " $pkg"
done
fi
cd /
# look for apk overlays.
for ovl in $mnt/*.apkovl.tar.gz ; do
if [ -f $ovl ] ; then
# remember to remove leading /
ovllist=`tar -C / -zvxf $ovl | sed 's:^/::'`
if [ "$ovllist" ] ; then
echo " Reading overlay: $ovl"
lbu update $ovllist 2>/dev/null
fi
fi
done
}
mount_once() {
if grep $1 < /proc/mounts >/dev/null 2>&1 ; then
NOUMOUNT=$1
else
mount $1 >/dev/null 2>&1
fi
}
umount_once() {
[ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
}
start() {
ebegin "Searching for local configurations"
# just in case...
modprobe usb-storage 2>/dev/null
modprobe sd_mod 2>/dev/null
modprobe floppy 2>/dev/null
modprobe cdrom 2>/dev/null
# if pkg_path is not specified as kernel arg, look for the packages
# on mounted cdrom
APK_PATH=`get_karg pkg_path`
# read configs if available
[ -f /etc/apk.conf ] && . /etc/apk.conf
[ -z "$APK_PATH" ] && APK_PATH="cdrom://apks"
export APK_PATH
# APK_CFG_MOUNTS
# if set, will only try to mount those, other wise try everything
# in /media/*
if [ "$APK_CFG_MOUNTS" ] ; then
mounts="$APK_CFG_MOUNTS"
else
mounts="*"
fi
cd /media
for m in $mounts ; do
mount_once /media/$m
load_pkgs_and_config /media/$m
sleep 1
umount_once /media/$m
done
eend
# if there are no /etc/apk.conf, create one
[ -f /etc/apk.conf ] || echo "APK_PATH=$APK_PATH" > /etc/apk.conf
}

13
init.d/syslog Executable file
View File

@ -0,0 +1,13 @@
#!/sbin/runscript
start() {
ebegin "Starting system logging"
syslogd && klogd
eend $?
}
stop () {
ebegin "Stopping system logging"
killall klogd && killall syslogd
eend $?
}

46
init.d/tuntap Executable file
View File

@ -0,0 +1,46 @@
#!/sbin/runscript
OPENVPN=`which openvpn 2>/dev/null`
TUNCTL=`which tunctl 2>/dev/null`
if [ -x "$OPENVPN" ] ; then
CREATETAP="$OPENVPN --mktun --dev"
else
CREATETAP="$TUNCTL -t"
fi
start() {
# verify tun/tap support in kernel
if ! [ -e /dev/net/tun ] ; then
modprobe tun 2>&1 >/dev/null && sleep 1
if ! [ -e /dev/net/tun ] ; then
eerror "Tun/Tap support is not present in kernel"
return 1
fi
fi
# verify if openvpn is present
if [ -x "$OPENVPN" ] ; then
MKTUNTAP="$OPENVPN --mktun --dev"
elif [ -x "$TUNCTL" ] ; then
MKTUNTAP="$TUNCTL -t"
else
eerror "Needs openvpn or tunctl to create Tun/Tap devices"
return 1
fi
# create devices
for iface in $DEVICES ; do
ebegin "Creating Tun/Tap interface $iface"
$MKTUNTAP $iface >/dev/null
eend $?
done
}
stop() {
ebegin "Destroying Tun/Tap interfaces"
rmmod tun 2>/dev/null
eend $?
}

32
init.d/udev Executable file
View File

@ -0,0 +1,32 @@
#!/sbin/runscript
start() {
ebegin "Starting udev"
#init sysfs
mkdir -p /dev
# use udevsend for hotplug
#echo /sbin/udevsend > /proc/sys/kernel/hotplug
echo "" > /proc/sys/kernel/hotplug
# start udev
mount /dev
start-stop-daemon --start --quiet --exec /sbin/udevd -- --daemon
udevstart 2>/dev/tty10
RC=$?
# create pts file system
[ -d /dev/pts ] || mkdir -m 755 /dev/pts
[ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
mount /dev/pts
eend $RC
}
stop() {
ebegin "Stopping udev"
start-stop-daemon --stop --quiet --exec /sbin/udevd
RC=$?
umount /dev/pts && umount /dev
eend $RC
}

11
init.d/udevqueue Executable file
View File

@ -0,0 +1,11 @@
#!/sbin/runscript
start() {
ebegin "Waiting on udev queue"
while [ -d /dev/.udev/queue ] ; do
sleep 1
echo -n "."
done
eend 0
}

50
init.d/udhcpc Normal file
View File

@ -0,0 +1,50 @@
#!/bin/sh
# /etc/init.d/udhcpc: start or stop udhcpc client
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/sbin/udhcpc
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting DHCP client: udhcpc"
start-stop-daemon --start --quiet --exec $DAEMON \
-- --script=/etc/udhcpc.script || echo -n " already running"
echo "."
;;
restart)
/etc/init.d/udhcpc stop
/etc/init.d/udhcpc start
;;
reload)
;;
force-reload)
;;
stop)
echo -n "Stopping DHCP client: udhcpc"
start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " not running"
echo "."
;;
renew)
start-stop-daemon --signal USR1 --stop --quiet --exec $DAEMON || echo -n " not running"
;;
release)
start-stop-daemon --signal USR2 --stop --quiet --exec $DAEMON || echo -n " not running"
;;
*)
echo "Usage: /etc/init.d/udhcpc {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0

14
init.d/watchdog Executable file
View File

@ -0,0 +1,14 @@
#!/sbin/runscript
start() {
[ "$WATCHDOG_DEV" ] || die "WATCHDOG_DEV is not set"
ebegin "Starting $SVCNAME"
$SVCNAME $WATCHDOG_OPTS $WATCHDOG_DEV
eend $?
}
stop () {
ebegin "Stopping $SVCNAME"
killall $SVCNAME
eend $?
}

22
inittab Normal file
View File

@ -0,0 +1,22 @@
# /etc/inittab
::sysinit:/etc/init.d/rcS
::wait:/etc/init.d/rcL
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r 2>/dev/null
null::shutdown:/sbin/swapoff -a 2>/dev/null

3
issue Normal file
View File

@ -0,0 +1,3 @@
This is \n. (\s \m \r) \t

83
mdev.conf Normal file
View File

@ -0,0 +1,83 @@
#
# This is a sample mdev.conf.
#
SLEEP=10
# Symlinks:
# Syntax: %s -> %s
MAKEDEV -> ../sbin/MAKEDEV
/proc/core -> kcore
fd -> /proc/self/fd
mcdx -> mcdx0
radio -> radio0
ram -> ram1
sbpcd -> sbpcd0
sr0 -> scd0
sr1 -> scd1
sr10 -> scd10
sr11 -> scd11
sr12 -> scd12
sr13 -> scd13
sr14 -> scd14
sr15 -> scd15
sr16 -> scd16
sr2 -> scd2
sr3 -> scd3
sr4 -> scd4
sr5 -> scd5
sr6 -> scd6
sr7 -> scd7
sr8 -> scd8
sr9 -> scd9
stderr -> fd/2
stdin -> fd/0
stdout -> fd/1
vbi -> vbi0
#vcs -> vcs0
#vcsa -> vcsa0
video -> video0
# Devices:
# Syntax: %s %d:%d %s
# devices user:group mode
null root:root 777
zero root:root 666
grsec root:root 660
urandom root:root 444
console root:tty 0600
fd0 root:floppy 0660
kmem root:root 000
mem root:root 0640
port root:root 0640
ptmx root:tty 0660
sd[a-z][0-9]* root:disk 0660 */lib/mdev/sd_links
hd[a-z][0-9]* root:disk 0660 */lib/mdev/ide_links
md[0-9] root:disk 0660
tty root:tty 0666
tty[0-9] root:tty 0660
tty[0-9][0-9] root:tty 0660
ttyS[0-9]* root:tty 640
ttyLTM[0-9] root:dialout 0660 @ln -sf $MDEV modem
video.* root:video 0660
# alsa sound devices
pcm.* root:audio 0660 */lib/mdev/subdir_dev snd
control.* root:audio 0660 */lib/mdev/subdir_dev snd
midi.* root:audio 0660 */lib/mdev/subdir_dev snd
seq root:audio 0660 */lib/mdev/subdir_dev snd
timer root:audio 0660 */lib/mdev/subdir_dev snd
# load drivers for usb devices
usbdev[0-9].* root:root 0660 */lib/mdev/usbdev
# net devices
tun[0-9]* root:root 0600 */lib/mdev/subdir_dev net
tap[0-9]* root:root 0600 */lib/mdev/subdir_dev net

4
nsswitch.conf Normal file
View File

@ -0,0 +1,4 @@
# Default settings for nsswitch.conf as needed for tinylogin
passwd: compat
group: compat
shadow: compat

42
passwd Normal file
View File

@ -0,0 +1,42 @@
root:x:0:0:root:/root:/bin/ash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/bin/false
news:x:9:13:news:/usr/lib/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
operator:x:11:0:operator:/root:/bin/bash
man:x:13:15:man:/usr/man:/bin/false
postmaster:x:14:12:postmaster:/var/spool/mail:/bin/false
cron:x:16:16:cron:/var/spool/cron:/bin/false
ftp:x:21:21::/home/ftp:/bin/false
sshd:x:22:22:sshd:/dev/null:/bin/false
at:x:25:25:at:/var/spool/cron/atjobs:/bin/false
squid:x:31:31:Squid:/var/cache/squid:/bin/false
gdm:x:32:32:GDM:/var/lib/gdm:/bin/false
xfs:x:33:33:X Font Server:/etc/X11/fs:/bin/false
games:x:35:35:games:/usr/games:/bin/false
named:x:40:40:bind:/var/bind:/bin/false
mysql:x:60:60:mysql:/var/lib/mysql:/bin/false
postgres:x:70:70::/var/lib/postgresql:/bin/bash
apache:x:81:81:apache:/home/httpd:/bin/false
nut:x:84:84:nut:/var/state/nut:/bin/false
cyrus:x:85:12::/usr/cyrus:/bin/false
vpopmail:x:89:89::/var/vpopmail:/bin/false
alias:x:200:200::/var/qmail/alias:/bin/false
qmaild:x:201:200::/var/qmail:/bin/false
qmaill:x:202:200::/var/qmail:/bin/false
qmailp:x:203:200::/var/qmail:/bin/false
qmailq:x:204:201::/var/qmail:/bin/false
qmailr:x:205:201::/var/qmail:/bin/false
qmails:x:206:201::/var/qmail:/bin/false
postfix:x:207:207:postfix:/var/spool/postfix:/bin/false
smmsp:x:209:209:smmsp:/var/spool/mqueue:/bin/false
portage:x:250:250:portage:/var/tmp/portage:/bin/false
guest:x:405:100:guest:/dev/null:/dev/null
nobody:x:65534:65534:nobody:/:/bin/false
distcc:x:240:2:distccd:/dev/null:/bin/false

2
profile Normal file
View File

@ -0,0 +1,2 @@
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
umask 022

45
protocols Normal file
View File

@ -0,0 +1,45 @@
# /etc/protocols:
# $Id: protocols,v 1.1 2004/02/04 03:32:40 pebenito Exp $
# $Header: /home/cvsroot/gentoo-projects/embedded/baselayout-lite/protocols,v 1.1 2004/02/04 03:32:40 pebenito Exp $
#
# Internet (IP) protocols
#
# from: @(#)protocols 5.1 (Berkeley) 4/17/89
#
# Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992).
ip 0 IP # internet protocol, pseudo protocol number
icmp 1 ICMP # internet control message protocol
igmp 2 IGMP # Internet Group Management
ggp 3 GGP # gateway-gateway protocol
ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
st 5 ST # ST datagram mode
tcp 6 TCP # transmission control protocol
egp 8 EGP # exterior gateway protocol
pup 12 PUP # PARC universal packet protocol
udp 17 UDP # user datagram protocol
hmp 20 HMP # host monitoring protocol
xns-idp 22 XNS-IDP # Xerox NS IDP
rdp 27 RDP # "reliable datagram" protocol
iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4
xtp 36 XTP # Xpress Tranfer Protocol
ddp 37 DDP # Datagram Delivery Protocol
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport
ipv6 41 IPv6 # IPv6
ipv6-route 43 IPv6-Route # Routing Header for IPv6
ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6
idrp 45 IDRP # Inter-Domain Routing Protocol
rsvp 46 RSVP # Reservation Protocol
gre 47 GRE # General Routing Encapsulation
esp 50 ESP # Encap Security Payload for IPv6
ah 51 AH # Authentication Header for IPv6
skip 57 SKIP # SKIP
ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6
ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6
ipv6-opts 60 IPv6-Opts # Destination Options for IPv6
rspf 73 RSPF # Radio Shortest Path First.
vmtp 81 VMTP # Versatile Message Transport
ospf 89 OSPFIGP # Open Shortest Path First IGP
ipip 94 IPIP # IP-within-IP Encapsulation Protocol
encap 98 ENCAP # Yet Another IP encapsulation
pim 103 PIM # Protocol Independent Multicast

26
rc-services.sh Normal file
View File

@ -0,0 +1,26 @@
RC_GOT_SERVICES="yes"
[ "$RC_GOT_FUNCTIONS" ] || . /sbin/functions.sh
# void save_options(char *option, char *optstring)
save_options() {
local myopts="$1"
shift
if [ ! -d "${svcdir}/options/${SVCNAME}" ] ; then
mkdir -p -m 0755 "${svcdir}/options/${SVCNAME}"
fi
echo "$*" > "${svcdir}/options/${SVCNAME}/${myopts}"
}
# char *get_options(char *option)
get_options() {
local svc="${SVCNAME}"
[ -n $2 ] && svc="$2"
if [ -f "${svcdir}/options/${svc}/$1" ] ; then
echo "$(< ${svcdir}/options/${svc}/$1)"
fi
}

78
rc_add Executable file
View File

@ -0,0 +1,78 @@
#!/bin/sh
#
# rc_add - add an init script to a runlevel
#
# Copyright (c) 2005 Natanael Copa
#
# Distributed under GPL-2
#
PROGRAM=`basename $0`
#load the libraries
. /sbin/functions.sh
STARTNUM=50
RCDIR="$ROOT/etc/rcL.d"
die() {
echo "$1" >&2
exit 1
}
# print usage and die
usage() {
echo "$PROGRAM $VERSION"
echo "usage: $PROGRAM [-hv] [-s number] script"
echo ""
echo " -h Show help and exit."
echo " -k Also add a corresponding kill link for shutdown/reboot."
echo " -s Set two-digit start number (00-99). Default is $STARTNUM."
echo " -S Add service as a system init service (rcS.d)."
echo " -v Turn on verbose output."
echo ""
exit 1
}
#parse args
unset vflag
while getopts "hks:Sv" opt ; do
case "$opt" in
h) usage;;
k) KILL="-k";;
s) STARTNUM="$OPTARG";;
S) RCDIR="ROOT/rcS.d";;
v) vflag="-v"; VERBOSE=1 ;;
\?) usage;;
esac
done
shift `expr $OPTIND - 1`
# check if script is specified
[ $# -lt 1 ] && usage
while [ $# -gt 0 ] ; do
SCRIPT="$1"
# validate the start number
echo "$STARTNUM" | grep '^[0-9][0-9]$' > /dev/null || die "Start number needs to be a 2 digit number. (00-99)"
mkdir -p "$ROOT/$RCDIR"
cd "$ROOT/$RCDIR"
LINKTARGET="../init.d/$SCRIPT"
[ -f "$LINKTARGET" ] || die "Could not find init script $LINKTARGET"
SLINK="S$LEVEL$STARTNUM$SCRIPT"
[ "$VERBOSE" ] && echo "Creating $ROOT/$RCDIR/$SLINK."
ln -sf $LINKTARGET "$ROOT/$RCDIR/$SLINK" || exit $?
if [ "$KILL" ] ; then
KLINK="K$LEVEL$STARTNUM$SCRIPT"
[ "$VERBOSE" ] && echo "Creating $ROOT/etc/rcK.d/$KLINK."
mkdir -p "$ROOT/etc/rcK.d"
ln -sf $LINKTARGET "$ROOT/etc/rcK.d/$KLINK" || exit $?
fi
shift
done
exit 0

68
rc_delete Executable file
View File

@ -0,0 +1,68 @@
#!/bin/sh
#
# rc_delete - delete an init script from a runlevel
#
# Copyright (c) 2005 Natanael Copa
#
# Distributed under GPL-2
#
PROGRAM=`basename $0`
#load the libraries
. /sbin/functions.sh
LEVEL=4
die() {
echo "$1" >&2
exit 1
}
# print usage and die
usage() {
echo "$PROGRAM $VERSION"
echo "usage: $PROGRAM [-hv] [-l level] script..."
echo ""
echo " -h Show help and exit."
echo " -l Only remove from specified level. Default is all levels."
echo " -v Turn on verbose output."
echo ""
exit 1
}
#parse args
unset vflag
while getopts "hl:v" opt ; do
case "$opt" in
h) usage;;
l) LEVEL="$OPTARG";;
v) vflag="-v"; VERBOSE=1 ;;
\?) usage;;
esac
done
shift `expr $OPTIND - 1`
# check if script is specified
[ $# -lt 1 ] && usage
while [ $# -gt 0 ] ; do
SCRIPT="$1"
rclinks=""
for rcl in $ROOT/etc/rcS.d/[S][0-9][0-9]$SCRIPT \
$ROOT/etc/rcL.d/[SK][0-9][0-9]$SCRIPT \
$ROOT/etc/rcK.d/[SK][0-9][0-9]$SCRIPT ; do
[ -e "$rcl" ] || continue
echo "$rcl"
rclinks="$rclinks $rcl"
done
for rclink in $rclinks ; do
[ "$VERBOSE" ] && echo "Removing $rclink."
rm -f $rclink
done
shift
done
exit 0

57
rc_status Executable file
View File

@ -0,0 +1,57 @@
#!/bin/sh
#
# rc_status - show status of boot scripts
#
# Copyright (c) 2005 Natanael Copa
#
# Distributed under GPL-2
#
PROGRAM=`basename $0`
#load the libraries
. /sbin/functions.sh
die() {
echo "$1" >&2
exit 1
}
# print usage and die
usage() {
echo "$PROGRAM $VERSION"
echo "usage: $PROGRAM [-hv] [-l level] [script]"
echo ""
echo " -h Show help and exit."
echo " -l Show only specified level."
echo " -v Turn on verbose output."
echo ""
exit 1
}
#parse args
while getopts "hl:v" opt ; do
case "$opt" in
h) usage;;
l) case "$OPTARG" in
S|L|K) LEVELS="$LEVELS $OPTARG";;
*) die "Valid levels are: all, S, K and L";;
esac
;;
v) VERBOSE="-v" ;;
\?) usage;;
esac
done
shift `expr $OPTIND - 1`
cd "$ROOT/etc"
[ -z "$LEVELS" ] && LEVELS="S L K"
for i in $LEVELS ; do
echo "rc$i.d:"
ls -1 $VERBOSE rc$i.d 2>/dev/null
echo ""
done
exit

85
runscript-alpine.sh Executable file
View File

@ -0,0 +1,85 @@
#!/bin/sh
myscript="$1"
if [ -L $1 ] ; then
myservice=$(readlink "$1")
else
myservice=$1
fi
myservice=`basename ${myservice}`
export SVCNAME=${myservice}
[ "$RC_GOT_FUNCTIONS" ] || . /sbin/functions.sh
# wrapper for busybox killall
killall() {
local flags ka
ka=`which killall`
while [ $# -gt 0 ] ; do
case "$1" in
-*) flags="$flags $1";;
*) flags="$flags `basename $1`"
esac
shift
done
$ka $flags
}
svc_start() {
start
}
svc_stop() {
stop
}
svc_status() {
status
}
restart() {
svc_stop
sleep 1
svc_start
}
usage() {
local i uopts
for i in $opts; do
uopts="$uopts|$i"
done
echo "usage: $myscript start|stop|status|restart$uopts"
exit $1
}
[ -f "/etc/conf.d/$myservice" ] && . "/etc/conf.d/$myservice"
. "$myscript"
shift
if [[ $# -lt 1 ]] ; then
usage 1
fi
for arg in $* ; do
case "${arg}" in
start)
svc_start
;;
stop)
svc_stop
;;
status)
svc_status
;;
restart)
restart
;;
*)
for opt in $opts ; do
[ "$arg" = "$opt" ] && $arg
done
;;
esac
done

78
sd_links Normal file
View File

@ -0,0 +1,78 @@
#!/bin/sh
# NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars.
# function to create a link to a disk (sd[a-z])
mklink_disk() {
local last
# find the last disk
last=`ls usb[a-z] 2>/dev/null | sort | tail -n 1 | sed 's/usb\([a-z]\).*/\1/'`
if [ "$last" ] ; then
# get next char in alphabet
next=`echo $last | tr 'abcdeghijklmnopqrstuvwxy' \
'bcdefghijklmnopqrtuvwxyz'`
else
# its the first
next="a"
fi
DISKLINK=usb$next
ln -sf $DISK $DISKLINK
}
# function to create a link to a partition (sd[a-z][0-9])
mklink_partition() {
local num
num=`echo $MDEV | sed 's/sd[a-z]//'`
for i in usb[a-z] ; do
if [ "`readlink $i 2>/dev/null`" = $DISK ] ; then
DISKLINK=$i
break
fi
done
# if there are no disk link then create one.
[ "$DISKLINK" ] || mklink_disk
# create the link to the partition
ln -sf $MDEV $DISKLINK$num
}
# check if there already exist an usb link to this dev.
for i in usb[a-z] usb[a-z][0-9]* ; do
if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
USBLINK=$i
break
fi
done
if [ "$USBLINK" ] ;then
# hotplug remove action
[ "$ACTION" = "remove" ] && rm $USBLINK
# the link already exist or is not supposed to exist. We are done.
exit
fi
# find out if its a disk or a partition
if [ -d /sys/block/$MDEV ] ; then
TYPE=disk
DISK=$MDEV
SCSIDEV=/sys/block/$MDEV/device/scsi_device:*
elif [ -d /sys/block/*/$MDEV ] ; then
TYPE=partition
PARENT=`dirname /sys/block/*/$MDEV`
DISK=`basename $PARENT`
SCSIDEV=$PARENT/device/scsi_device:*
else
exit
fi
# check if the scsi host belongs to usb-storage. exit if it doesn't
SCSI_HOST=`basename $SCSIDEV | cut -d : -f 2`
[ -f "/proc/scsi/usb-storage/$SCSI_HOST" ] || exit
# create link
mklink_$TYPE

969
services Normal file
View File

@ -0,0 +1,969 @@
# /etc/services
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
#
# Some References:
# http://www.iana.org/assignments/port-numbers
# http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services
#
# Each line describes one service, and is of the form:
# service-name port/protocol [aliases ...] [# comment]
#
#
# IANA Assignments [Well Known Ports]
# The Well Known Ports are assigned by the IANA and on most systems can
# only be used by system (or root) processes or by programs executed by
# privileged users.
# The range for assigned ports managed by the IANA is 0-1023.
#
tcpmux 1/tcp # TCP port service multiplexer
tcpmux 1/udp
compressnet 2/tcp # Management Utility
compressnet 2/udp
compressnet 3/tcp # Compression Process
compressnet 3/udp
rje 5/tcp # Remote Job Entry
rje 5/udp
echo 7/tcp # Echo
echo 7/udp
discard 9/tcp sink null # Discard
discard 9/udp sink null
systat 11/tcp users # Active Users
systat 11/udp users
daytime 13/tcp # Daytime (RFC 867)
daytime 13/udp
#netstat 15/tcp # (was once asssigned, no more)
qotd 17/tcp quote # Quote of the Day
qotd 17/udp quote
msp 18/tcp # Message Send Protocol
msp 18/udp
chargen 19/tcp ttytst source # Character Generator
chargen 19/udp ttytst source
ftp-data 20/tcp # File Transfer [Default Data]
ftp-data 20/udp
ftp 21/tcp # File Transfer [Control]
ftp 21/udp fsp fspd
ssh 22/tcp # SSH Remote Login Protocol
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
# private 24/tcp # any private mail system
# private 24/udp
smtp 25/tcp mail # Simple Mail Transfer
smtp 25/udp
nsw-fe 27/tcp # NSW User System FE
nsw-fe 27/udp
msg-icp 29/tcp # MSG ICP
msg-icp 29/udp
msg-auth 31/tcp # MSG Authentication
msg-auth 31/udp
dsp 33/tcp # Display Support Protocol
dsp 33/udp
# private 35/tcp # any private printer server
# private 35/udp
time 37/tcp timserver
time 37/udp timserver
rap 38/tcp # Route Access Protocol
rap 38/udp
rlp 39/tcp resource # Resource Location Protocol
rlp 39/udp resource
graphics 41/tcp # Graphics
graphics 41/udp
nameserver 42/tcp name # Host Name Server
nameserver 42/udp name
nicname 43/tcp whois # Who Is
nicname 43/udp whois
mpm-flags 44/tcp # MPM FLAGS Protocol
mpm-flags 44/udp
mpm 45/tcp # Message Processing Module [recv]
mpm 45/udp
mpm-snd 46/tcp # MPM [default send]
mpm-snd 46/udp
ni-ftp 47/tcp # NI FTP
ni-ftp 47/udp
auditd 48/tcp # Digital Audit Daemon
auditd 48/udp
tacacs 49/tcp # Login Host Protocol (TACACS)
tacacs 49/udp
re-mail-ck 50/tcp # Remote Mail Checking Protocol
re-mail-ck 50/udp
domain 53/tcp # Domain Name Server
domain 53/udp
xns-ch 54/tcp # XNS Clearinghouse
xns-ch 54/udp
isi-gl 55/tcp # ISI Graphics Language
isi-gl 55/udp
xns-auth 56/tcp # XNS Authentication
xns-auth 56/udp
# private 57/tcp # any private terminal access
# private 57/udp
xns-mail 58/tcp # XNS Mail
xns-mail 58/udp
# private 59/tcp # any private file service
# private 59/udp
ni-mail 61/tcp # NI MAIL
ni-mail 61/udp
acas 62/tcp # ACA Services
acas 62/udp
whois++ 63/tcp # whois++
whois++ 63/udp
covia 64/tcp # Communications Integrator (CI)
covia 64/udp
tacacs-ds 65/tcp # TACACS-Database Service
tacacs-ds 65/udp
sql*net 66/tcp # Oracle SQL*NET
sql*net 66/udp
bootps 67/tcp # Bootstrap Protocol Server (BOOTP)
bootps 67/udp
bootpc 68/tcp # Bootstrap Protocol Client (BOOTP)
bootpc 68/udp
tftp 69/tcp # Trivial File Transfer
tftp 69/udp
gopher 70/tcp # Gopher
gopher 70/udp
netrjs-1 71/tcp # Remote Job Service
netrjs-1 71/udp
netrjs-2 72/tcp
netrjs-2 72/udp
netrjs-3 73/tcp
netrjs-3 73/udp
netrjs-4 74/tcp
netrjs-4 74/udp
# private 75/tcp # any private dial out service
# private 75/udp
deos 76/tcp # Distributed External Object Store
deos 76/udp
# private 77/tcp # any private RJE service
# private 77/udp
vettcp 78/tcp # vettcp
vettcp 78/udp
finger 79/tcp # Finger
finger 79/udp
http 80/tcp www www-http # World Wide Web HTTP
http 80/udp www www-http
hosts2-ns 81/tcp # HOSTS2 Name Server
hosts2-ns 81/udp
xfer 82/tcp # XFER Utility
xfer 82/udp
mit-ml-dev 83/tcp # MIT ML Device
mit-ml-dev 83/udp
ctf 84/tcp # Common Trace Facility
ctf 84/udp
mit-ml-dev 85/tcp # MIT ML Device
mit-ml-dev 85/udp
mfcobol 86/tcp # Micro Focus Cobol
mfcobol 86/udp
# private 87/tcp # any private terminal link
# private 87/udp
kerberos 88/tcp kerberos5 krb5 # Kerberos
kerberos 88/udp kerberos5 krb5
su-mit-tg 89/tcp # SU/MIT Telnet Gateway
su-mit-tg 89/udp
dnsix 90/tcp # DNSIX Securit Attribute Token Map
dnsix 90/udp
mit-dov 91/tcp # MIT Dover Spooler
mit-dov 91/udp
npp 92/tcp # Network Printing Protocol
npp 92/udp
dcp 93/tcp # Device Control Protocol
dcp 93/udp
objcall 94/tcp # Tivoli Object Dispatcher
objcall 94/udp
supdup 95/tcp # SUPDUP
supdup 95/udp
dixie 96/tcp # DIXIE Protocol Specification
dixie 96/udp
swift-rvf 97/tcp # Swift Remote Virtural File Protocol
swift-rvf 97/udp
tacnews 98/tcp # TAC News
tacnews 98/udp
metagram 99/tcp # Metagram Relay
metagram 99/udp
#newacct 100/tcp # [unauthorized use]
hostname 101/tcp hostnames # NIC Host Name Server
hostname 101/udp hostnames
iso-tsap 102/tcp tsap # ISO-TSAP Class 0
iso-tsap 102/udp tsap
gppitnp 103/tcp # Genesis Point-to-Point Trans Net
gppitnp 103/udp
acr-nema 104/tcp # ACR-NEMA Digital Imag. & Comm. 300
acr-nema 104/udp
cso 105/tcp csnet-ns cso-ns # CCSO name server protocol
cso 105/udp csnet-ns cso-ns
3com-tsmux 106/tcp poppassd # 3COM-TSMUX
3com-tsmux 106/udp poppassd # Eudora: Unauthorized use by insecure poppassd protocol
rtelnet 107/tcp # Remote Telnet Service
rtelnet 107/udp
snagas 108/tcp # SNA Gateway Access Server
snagas 108/udp
pop2 109/tcp pop-2 postoffice# Post Office Protocol - Version 2
pop2 109/udp pop-2
pop3 110/tcp pop-3 # Post Office Protocol - Version 3
pop3 110/udp pop-3
sunrpc 111/tcp portmapper # SUN Remote Procedure Call
sunrpc 111/udp portmapper
mcidas 112/tcp # McIDAS Data Transmission Protocol
mcidas 112/udp
auth 113/tcp authentication tap ident # Authentication Service
auth 113/udp
sftp 115/tcp # Simple File Transfer Protocol
sftp 115/udp
ansanotify 116/tcp # ANSA REX Notify
ansanotify 116/udp
uucp-path 117/tcp # UUCP Path Service
uucp-path 117/udp
sqlserv 118/tcp # SQL Services
sqlserv 118/udp
nntp 119/tcp readnews untp # Network News Transfer Protocol
nntp 119/udp readnews untp
cfdptkt 120/tcp # CFDPTKT
cfdptkt 120/udp
erpc 121/tcp # Encore Expedited Remote Pro.Call
erpc 121/udp
smakynet 122/tcp # SMAKYNET
smakynet 122/udp
ntp 123/tcp # Network Time Protocol
ntp 123/udp
ansatrader 124/tcp # ANSA REX Trader
ansatrader 124/udp
locus-map 125/tcp # Locus PC-Interface Net Map Ser
locus-map 125/udp
nxedit 126/tcp unitary # NXEdit
nxedit 126/udp unitary # Unisys Unitary Login
locus-con 127/tcp # Locus PC-Interface Conn Server
locus-con 127/udp
gss-xlicen 128/tcp # GSS X License Verification
gss-xlicen 128/udp
pwdgen 129/tcp # Password Generator Protocol
pwdgen 129/udp
cisco-fna 130/tcp # cisco FNATIVE
cisco-fna 130/udp
cisco-tna 131/tcp # cisco TNATIVE
cisco-tna 131/udp
cisco-sys 132/tcp # cisco SYSMAINT
cisco-sys 132/udp
statsrv 133/tcp # Statistics Service
statsrv 133/udp
ingres-net 134/tcp # INGRES-NET Service
ingres-net 134/udp
epmap 135/tcp loc-srv # DCE endpoint resolution
epmap 135/udp loc-srv
profile 136/tcp # PROFILE Naming System
profile 136/udp
netbios-ns 137/tcp # NETBIOS Name Service
netbios-ns 137/udp
netbios-dgm 138/tcp # NETBIOS Datagram Service
netbios-dgm 138/udp
netbios-ssn 139/tcp # NETBIOS Session Service
netbios-ssn 139/udp
emfis-data 140/tcp # EMFIS Data Service
emfis-data 140/udp
emfis-cntl 141/tcp # EMFIS Control Service
emfis-cntl 141/udp
imap 143/tcp imap2 # Internet Message Access Protocol
imap 143/udp imap2
uma 144/tcp # Universal Management Architecture
uma 144/udp
uaac 145/tcp # UAAC Protocol
uaac 145/udp
iso-tp0 146/tcp # ISO-TP0
iso-tp0 146/udp
iso-ip 147/tcp # ISO-IP
iso-ip 147/udp
jargon 148/tcp # Jargon
jargon 148/udp
aed-512 149/tcp # AED 512 Emulation Service
aed-512 149/udp
sql-net 150/tcp # SQL-NET
sql-net 150/udp
hems 151/tcp # HEMS
hems 151/udp
bftp 152/tcp # Background File Transfer Program
bftp 152/udp
sgmp 153/tcp # SGMP
sgmp 153/udp
netsc-prod 154/tcp # NETSC
netsc-prod 154/udp
netsc-dev 155/tcp
netsc-dev 155/udp
sqlsrv 156/tcp # SQL Service
sqlsrv 156/udp
knet-cmp 157/tcp # KNET/VM Command/Message Protocol
knet-cmp 157/udp
pcmail-srv 158/tcp # PCMail Server
pcmail-srv 158/udp
nss-routing 159/tcp # NSS-Routing
nss-routing 159/udp
sgmp-traps 160/tcp # SGMP-TRAPS
sgmp-traps 160/udp
snmp 161/tcp # Simple Net Mgmt Proto
snmp 161/udp
snmptrap 162/tcp snmp-trap # Traps for SNMP
snmptrap 162/udp snmp-trap
cmip-man 163/tcp # CMIP/TCP Manager
cmip-man 163/udp
cmip-agent 164/tcp # CMIP/TCP Agent
cmip-agent 164/udp
xns-courier 165/tcp # Xerox
xns-courier 165/udp
s-net 166/tcp # Sirius Systems
s-net 166/udp
namp 167/tcp # NAMP
namp 167/udp
rsvd 168/tcp # RSVD
rsvd 168/udp
send 169/tcp # SEND
send 169/udp
print-srv 170/tcp # Network PostScript
print-srv 170/udp
multiplex 171/tcp # Network Innovations Multiplex
multiplex 171/udp
cl/1 172/tcp # Network Innovations CL/1
cl/1 172/udp
xyplex-mux 173/tcp # Xyplex
xyplex-mux 173/udp
mailq 174/tcp # Mailer transport queue for Zmailer
mailq 174/udp
vmnet 175/tcp # VMNET
vmnet 175/udp
genrad-mux 176/tcp # GENRAD-MUX
genrad-mux 176/udp
xdmcp 177/tcp # X Display Manager Control Protocol
xdmcp 177/udp
nextstep 178/tcp NeXTStep NextStep# NextStep Window Server
nextstep 178/udp NeXTStep NextStep
bgp 179/tcp # Border Gateway Protocol
bgp 179/udp
ris 180/tcp # Intergraph
ris 180/udp
unify 181/tcp # Unify
unify 181/udp
audit 182/tcp # Unisys Audit SITP
audit 182/udp
ocbinder 183/tcp # OCBinder
ocbinder 183/udp
ocserver 184/tcp # OCServer
ocserver 184/udp
remote-kis 185/tcp # Remote-KIS
remote-kis 185/udp
kis 186/tcp # KIS Protocol
kis 186/udp
aci 187/tcp # Application Communication Interface
aci 187/udp
mumps 188/tcp # Plus Five's MUMPS
mumps 188/udp
qft 189/tcp # Queued File Transport
qft 189/udp
gacp 190/tcp # Gateway Access Control Protocol
gacp 190/udp
prospero 191/tcp # Prospero Directory Service
prospero 191/udp
osu-nms 192/tcp # OSU Network Monitoring System
osu-nms 192/udp
srmp 193/tcp # Spider Remote Monitoring Protocol
srmp 193/udp
irc 194/tcp # Internet Relay Chat Protocol
irc 194/udp
dn6-nlm-aud 195/tcp # DNSIX Network Level Module Audit
dn6-nlm-aud 195/udp
dn6-smm-red 196/tcp # DNSIX Session Mgt Module Audit Redir
dn6-smm-red 196/udp
dls 197/tcp # Directory Location Service
dls 197/udp
dls-mon 198/tcp # Directory Location Service Monitor
dls-mon 198/udp
smux 199/tcp # SNMP Unix Multiplexer
smux 199/udp
src 200/tcp # IBM System Resource Controller
src 200/udp
at-rtmp 201/tcp # AppleTalk Routing Maintenance
at-rtmp 201/udp
at-nbp 202/tcp # AppleTalk Name Binding
at-nbp 202/udp
at-echo 204/tcp # AppleTalk Echo
at-echo 204/udp
at-zis 206/tcp # AppleTalk Zone Information
at-zis 206/udp
qmtp 209/tcp # The Quick Mail Transfer Protocol
qmtp 209/udp
z39.50 210/tcp wais z3950 # ANSI Z39.50
z39.50 210/udp wais z3950
914c/g 211/tcp # Texas Instruments 914C/G Terminal
914c/g 211/udp
anet 212/tcp # ATEXSSTR
anet 212/udp
ipx 213/tcp # IPX
ipx 213/udp
imap3 220/tcp # Interactive Mail Access
imap3 220/udp
link 245/tcp # ttylink
link 245/udp
pawserv 345/tcp # Perf Analysis Workbench
pawserv 345/udp
zserv 346/tcp # Zebra server
zserv 346/udp
fatserv 347/tcp # Fatmen Server
fatserv 347/udp
scoi2odialog 360/tcp # scoi2odialog
scoi2odialog 360/udp
semantix 361/tcp # Semantix
semantix 361/udp
srssend 362/tcp # SRS Send
srssend 362/udp
rsvp_tunnel 363/tcp # RSVP Tunnel
rsvp_tunnel 363/udp
aurora-cmgr 364/tcp # Aurora CMGR
aurora-cmgr 364/udp
dtk 365/tcp # Deception Tool Kit
dtk 365/udp
odmr 366/tcp # ODMR
odmr 366/udp
rpc2portmap 369/tcp # Coda portmapper
rpc2portmap 369/udp
codaauth2 370/tcp # Coda authentication server
codaauth2 370/udp
clearcase 371/tcp # Clearcase
clearcase 371/udp
ulistproc 372/tcp ulistserv # UNIX Listserv
ulistproc 372/udp ulistserv
ldap 389/tcp # Lightweight Directory Access Protocol
ldap 389/udp
imsp 406/tcp # Interactive Mail Support Protocol
imsp 406/udp
svrloc 427/tcp # Server Location
svrloc 427/udp
mobileip-agent 434/tcp # MobileIP-Agent
mobileip-agent 434/udp
mobilip-mn 435/tcp # MobilIP-MN
mobilip-mn 435/udp
https 443/tcp # MCom
https 443/udp
snpp 444/tcp # Simple Network Paging Protocol
snpp 444/udp
microsoft-ds 445/tcp Microsoft-DS
microsoft-ds 445/udp Microsoft-DS
kpasswd 464/tcp kpwd # Kerberos "passwd"
kpasswd 464/udp kpwd
photuris 468/tcp
photuris 468/udp
saft 487/tcp # Simple Asynchronous File Transfer
saft 487/udp
gss-http 488/tcp
gss-http 488/udp
pim-rp-disc 496/tcp
pim-rp-disc 496/udp
isakmp 500/tcp # IPsec - Internet Security Association and Key Management Protocol
isakmp 500/udp
exec 512/tcp # remote process execution
comsat 512/udp biff # notify users of new mail received
login 513/tcp # remote login a la telnet
who 513/udp whod # who's logged in to machines
shell 514/tcp cmd # no passwords used
syslog 514/udp
printer 515/tcp spooler # line printer spooler
printer 515/udp spooler
videotex 516/tcp
videotex 516/udp
talk 517/tcp # like tenex link
talk 517/udp
ntalk 518/tcp
ntalk 518/udp
utime 519/tcp unixtime
utime 519/udp unixtime
efs 520/tcp # extended file name server
router 520/udp route routed # local routing process
ripng 521/tcp
ripng 521/udp
ulp 522/tcp
ulp 522/udp
ibm-db2 523/tcp
ibm-db2 523/udp
ncp 524/tcp
ncp 524/udp
timed 525/tcp timeserver
timed 525/udp timeserver
tempo 526/tcp newdate
tempo 526/udp newdate
courier 530/tcp rpc
courier 530/udp rpc
conference 531/tcp chat
conference 531/udp chat
netnews 532/tcp readnews
netnews 532/udp readnews
netwall 533/tcp # -for emergency broadcasts
netwall 533/udp
mm-admin 534/tcp # MegaMedia Admin
mm-admin 534/udp
iiop 535/tcp
iiop 535/udp
opalis-rdv 536/tcp
opalis-rdv 536/udp
nmsp 537/tcp # Networked Media Streaming Protocol
nmsp 537/udp
gdomap 538/tcp # GNUstep distributed objects
gdomap 538/udp
uucp 540/tcp uucpd # uucp daemon
uucp 540/udp uucpd
klogin 543/tcp # Kerberized `rlogin' (v5)
klogin 543/udp
kshell 544/tcp krcmd # Kerberized `rsh' (v5)
kshell 544/udp krcmd
appleqtcsrvr 545/tcp
appleqtcsrvr 545/udp
dhcpv6-client 546/tcp # DHCPv6 Client
dhcpv6-client 546/udp
dhcpv6-server 547/tcp # DHCPv6 Server
dhcpv6-server 547/udp
afpovertcp 548/tcp # AFP over TCP
afpovertcp 548/udp
rtsp 554/tcp # Real Time Stream Control Protocol
rtsp 554/udp
dsf 555/tcp
dsf 555/udp
remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
remotefs 556/udp rfs_server rfs
nntps 563/tcp snntp # NNTP over SSL
nntps 563/udp snntp
9pfs 564/tcp # plan 9 file service
9pfs 564/udp
whoami 565/tcp
whoami 565/udp
submission 587/tcp # mail message submission
submission 587/udp
http-alt 591/tcp # FileMaker, Inc. - HTTP Alternate
http-alt 591/udp
nqs 607/tcp # Network Queuing system
nqs 607/udp
npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS
npmp-local 610/udp dqs313_qmaster
npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS
npmp-gui 611/udp dqs313_execd
hmmp-ind 612/tcp dqs313_intercell# HMMP Indication / DQS
hmmp-ind 612/udp dqs313_intercell
cryptoadmin 624/tcp # Crypto Admin
cryptoadmin 624/udp
dec_dlm 625/tcp # DEC DLM
dec_dlm 625/udp
asia 626/tcp
asia 626/udp
passgo-tivoli 627/tcp # PassGo Tivoli
passgo-tivoli 627/udp
qmqp 628/tcp # Qmail QMQP
qmqp 628/udp
3com-amp3 629/tcp
3com-amp3 629/udp
rda 630/tcp
rda 630/udp
ipp 631/tcp # Internet Printing Protocol
ipp 631/udp
ldaps 636/tcp # LDAP over SSL
ldaps 636/udp
tinc 655/tcp # TINC control port
tinc 655/udp
acap 674/tcp # Application Configuration Access Protocol
acap 674/udp
ha-cluster 694/tcp # Heartbeat HA-cluster
ha-cluster 694/udp
silc 706/tcp # SILC
silc 706/udp
kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
kerberos-adm 749/udp
kerberos-iv 750/tcp kerberos4 kdc # Kerberos (server)
kerberos-iv 750/udp kerberos4 kdc
webster 765/tcp # Network dictionary
webster 765/udp
phonebook 767/tcp # Network phonebook
phonebook 767/udp
rsync 873/tcp # rsync
rsync 873/udp
ftps-data 989/tcp # ftp protocol, data, over TLS/SSL
ftps-data 989/udp
ftps 990/tcp # ftp protocol, control, over TLS/SSL
ftps 990/udp
nas 991/tcp # Netnews Administration System
nas 991/udp
telnets 992/tcp # telnet protocol over TLS/SSL
telnets 992/udp
imaps 993/tcp # imap4 protocol over TLS/SSL
imaps 993/udp
ircs 994/tcp # irc protocol over TLS/SSL
ircs 994/udp
pop3s 995/tcp # pop3 protocol over TLS/SSL
pop3s 995/udp
#
# IANA Assignments [Registered Ports]
#
# The Registered Ports are listed by the IANA and on most systems can be
# used by ordinary user processes or programs executed by ordinary
# users.
# Ports are used in the TCP [RFC793] to name the ends of logical
# connections which carry long term conversations. For the purpose of
# providing services to unknown callers, a service contact port is
# defined. This list specifies the port used by the server process as
# its contact port.
# The IANA registers uses of these ports as a convenience to the
# community.
# To the extent possible, these same port assignments are used with the
# UDP [RFC768].
# The Registered Ports are in the range 1024-49151.
#
socks 1080/tcp # socks proxy server
socks 1080/udp
rmiregistry 1099/tcp # Java RMI Registry
rmiregistry 1099/udp
kazaa 1214/tcp # KAZAA
kazaa 1214/udp
bvcontrol 1236/tcp rmtcfg # Gracilis Packeten remote config server
bvcontrol 1236/udp rmtcfg
nessus 1241/tcp # Nessus vulnerability assessment scanner
nessus 1241/udp
h323hostcallsc 1300/tcp # H323 Host Call Secure
h323hostcallsc 1300/udp
lotusnote 1352/tcp # Lotus Note
lotusnote 1352/udp
ms-sql-s 1433/tcp # Microsoft-SQL-Server
ms-sql-s 1433/udp
ms-sql-m 1434/tcp # Microsoft-SQL-Monitor
ms-sql-m 1434/udp
ica 1494/tcp # Citrix ICA Client
ica 1494/udp
wins 1512/tcp # Microsoft's Windows Internet Name Service
wins 1512/udp
ingreslock 1524/tcp
ingreslock 1524/udp
prospero-np 1525/tcp # Prospero non-privileged
prospero-np 1525/udp
datametrics 1645/tcp old-radius # datametrics / old radius entry
datametrics 1645/udp old-radius
sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry
sa-msg-port 1646/udp old-radacct
rsap 1647/tcp
rsap 1647/udp
concurrent-lm 1648/tcp
concurrent-lm 1648/udp
kermit 1649/tcp
kermit 1649/udp
l2tp 1701/tcp
l2tp 1701/udp
h323gatedisc 1718/tcp
h323gatedisc 1718/udp
h323gatestat 1719/tcp
h323gatestat 1719/udp
h323hostcall 1720/tcp
h323hostcall 1720/udp
tftp-mcast 1758/tcp
tftp-mcast 1758/udp
hello 1789/tcp
hello 1789/udp
radius 1812/tcp # Radius
radius 1812/udp
radius-acct 1813/tcp radacct # Radius Accounting
radius-acct 1813/udp radacct
mtp 1911/tcp # Starlight Networks Multimedia Transport Protocol
mtp 1911/udp
unix-status 1957/tcp # remstats unix-status server
unix-status 1957/udp
hsrp 1985/tcp # Hot Standby Router Protocol
hsrp 1985/udp
licensedaemon 1986/tcp # cisco license management
licensedaemon 1986/udp
tr-rsrb-p1 1987/tcp # cisco RSRB Priority 1 port
tr-rsrb-p1 1987/udp
tr-rsrb-p2 1988/tcp # cisco RSRB Priority 2 port
tr-rsrb-p2 1988/udp
tr-rsrb-p3 1989/tcp # cisco RSRB Priority 3 port
tr-rsrb-p3 1989/udp
stun-p1 1990/tcp # cisco STUN Priority 1 port
stun-p1 1990/udp
stun-p2 1991/tcp # cisco STUN Priority 2 port
stun-p2 1991/udp
stun-p3 1992/tcp # cisco STUN Priority 3 port
stun-p3 1992/udp
snmp-tcp-port 1994/tcp # cisco SNMP TCP port
snmp-tcp-port 1994/udp
stun-port 1995/tcp # cisco serial tunnel port
stun-port 1995/udp
perf-port 1996/tcp # cisco Remote SRB port
perf-port 1996/udp
gdp-port 1997/tcp # cisco Gateway Discovery Protocol
gdp-port 1997/udp
x25-svc-port 1998/tcp # cisco X.25 service (XOT)
x25-svc-port 1998/udp
tcp-id-port 1999/tcp # cisco identification port
tcp-id-port 1999/udp
cisco-sccp 2000/tcp sieve # Cisco SCCP
cisco-sccp 2000/udp sieve
nfs 2049/tcp # Network File System
nfs 2049/udp
rtcm-sc104 2101/tcp # RTCM SC-104
rtcm-sc104 2101/udp
zephyr-srv 2102/tcp # Zephyr server
zephyr-srv 2102/udp
zephyr-clt 2103/tcp # Zephyr serv-hm connection
zephyr-clt 2103/udp
zephyr-hm 2104/tcp # Zephyr hostmanager
zephyr-hm 2104/udp
cvspserver 2401/tcp # CVS client/server operations
cvspserver 2401/udp
venus 2430/tcp # codacon port
venus 2430/udp
venus-se 2431/tcp # tcp side effects
venus-se 2431/udp
codasrv 2432/tcp # not used
codasrv 2432/udp
codasrv-se 2433/tcp # tcp side effects
codasrv-se 2433/udp
mon 2583/tcp
mon 2583/udp
hpstgmgr 2600/tcp zebrasrv
hpstgmgr 2600/udp zebrasrv
discp-client 2601/tcp zebra # discp client
discp-client 2601/udp zebra
discp-server 2602/tcp ripd # discp server
discp-server 2602/udp ripd
servicemeter 2603/tcp ripngd # Service Meter
servicemeter 2603/udp ripngd
nsc-ccs 2604/tcp ospfd # NSC CCS
nsc-ccs 2604/udp ospfd
nsc-posa 2605/tcp bgpd # NSC POSA
nsc-posa 2605/udp bgpd
netmon 2606/tcp ospf6d # Dell Netmon
netmon 2606/udp ospf6d
connection 2607/tcp # Dell Connection
connection 2607/udp
wag-service 2608/tcp # Wag Service
wag-service 2608/udp
dict 2628/tcp # Dictionary server
dict 2628/udp
corbaloc 2809/tcp # CORBA LOC
corbaloc 2809/udp
ndtp 2882/tcp # Network Dictionary Transfer Protocol
ndtp 2882/udp
gds_db 3050/tcp # InterBase server
gds_db 3050/udp
icpv2 3130/tcp icp # Internet Cache Protocol (Squid)
icpv2 3130/udp icp
mysql 3306/tcp # MySQL
mysql 3306/udp
trnsprntproxy 3346/tcp # Transparent Proxy
trnsprntproxy 3346/udp
ms-wbt-server 3389/tcp rdp # MS WBT Server
ms-wbt-server 3389/udp rdp # Microsoft Remote Desktop Protocol
prsvp 3455/tcp # RSVP Port
prsvp 3455/udp
nut 3493/tcp # Network UPS Tools
nut 3493/udp
distcc 3632/tcp # Distributed Compiler
distcc 3632/udp
daap 3689/tcp # Digital Audio Access Protocol
daap 3689/udp
svn 3690/tcp # Subversion
svn 3690/udp
netboot-pxe 3928/tcp pxe # PXE NetBoot Manager
netboot-pxe 3928/udp pxe
smauth-port 3929/tcp # AMS Port
smauth-port 3929/udp
pxc-spvr-ft 4002/tcp pxc-spvr-ft rquotad
pxc-spvr-ft 4002/udp pxc-spvr-ft rquotad
pxc-splr-ft 4003/tcp pxc-splr-ft
pxc-splr-ft 4003/udp pxc-splr-ft
pxc-roid 4004/tcp pxc-roid
pxc-roid 4004/udp pxc-roid
pxc-pin 4005/tcp pxc-pin
pxc-pin 4005/udp pxc-pin
pxc-spvr 4006/tcp pxc-spvr
pxc-spvr 4006/udp pxc-spvr
pxc-splr 4007/tcp pxc-splr
pxc-splr 4007/udp pxc-splr
rwhois 4321/tcp # Remote Who Is
rwhois 4321/udp
krb524 4444/tcp
krb524 4444/udp
hylafax 4559/tcp # HylaFAX client-server protocol (new)
hylafax 4559/udp
piranha1 4600/tcp
piranha1 4600/udp
radmin-port 4899/tcp # RAdmin Port
radmin-port 4899/udp
rfe 5002/tcp # Radio Free Ethernet
rfe 5002/udp
ita-agent 5051/tcp # ITA Agent
ita-agent 5051/udp
xmpp-client 5222/tcp # XMPP Client Connection
xmpp-client 5222/udp
xmpp-server 5269/tcp # XMPP Server Connection
xmpp-server 5269/udp
cfengine 5308/tcp # CFengine
cfengine 5308/udp
postgresql 5432/tcp # POSTGRES
postgresql 5432/udp
sgi-eventmond 5553/tcp # SGI Eventmond Port
sgi-eventmond 5553/udp
sgi-esphttp 5554/tcp # SGI ESP HTTP
sgi-esphttp 5554/udp
cvsup 5999/tcp # CVSup
cvsup 5999/udp
x11 6000/tcp # X Window System
x11 6000/udp
gnutella-svc 6346/tcp
gnutella-svc 6346/udp
gnutella-rtr 6347/tcp
gnutella-rtr 6347/udp
sane-port 6566/tcp # SANE Network Scanner Control Port
sane-port 6566/udp
afs3-fileserver 7000/tcp bbs # file server itself
afs3-fileserver 7000/udp bbs
afs3-callback 7001/tcp # callbacks to cache managers
afs3-callback 7001/udp
afs3-prserver 7002/tcp # users & groups database
afs3-prserver 7002/udp
afs3-vlserver 7003/tcp # volume location database
afs3-vlserver 7003/udp
afs3-kaserver 7004/tcp # AFS/Kerberos authentication
afs3-kaserver 7004/udp
afs3-volser 7005/tcp # volume managment server
afs3-volser 7005/udp
afs3-errors 7006/tcp # error interpretation service
afs3-errors 7006/udp
afs3-bos 7007/tcp # basic overseer process
afs3-bos 7007/udp
afs3-update 7008/tcp # server-to-server updater
afs3-update 7008/udp
afs3-rmtsys 7009/tcp # remote cache manager service
afs3-rmtsys 7009/udp
font-service 7100/tcp xfs # X Font Service
font-service 7100/udp xfs
http-alt 8008/tcp # HTTP Alternate
http-alt 8008/udp
http-alt 8080/tcp # HTTP Alternate
http-alt 8080/udp
bacula-dir 9101/tcp # Bacula Director
bacula-dir 9101/udp
bacula-fd 9102/tcp # Bacula File Daemon
bacula-fd 9102/udp
bacula-sd 9103/tcp # Bacula Storage Daemon
bacula-sd 9103/udp
sd 9876/tcp # Session Director
sd 9876/udp
cyborg-systems 9888/tcp # CYBORG Systems
cyborg-systems 9888/udp
monkeycom 9898/tcp # MonkeyCom
monkeycom 9898/udp
amanda 10080/tcp # amanda backup services
amanda 10080/udp
smsqp 11201/tcp # Alamin SMS gateway
smsqp 11201/udp
hkp 11371/tcp # OpenPGP HTTP Keyserver
hkp 11371/udp
h323callsigalt 11720/tcp # h323 Call Signal Alternate
h323callsigalt 11720/udp
bprd 13720/tcp # BPRD Protocol (VERITAS NetBackup)
bprd 13720/udp
bpdbm 13721/tcp # BPDBM Protocol (VERITAS NetBackup)
bpdbm 13721/udp
bpjava-msvc 13722/tcp # BP Java MSVC Protocol
bpjava-msvc 13722/udp
vnetd 13724/tcp # Veritas Network Utility
vnetd 13724/udp
bpcd 13782/tcp # VERITAS NetBackup
bpcd 13782/udp
vopied 13783/tcp # VOPIED Protocol
vopied 13783/udp
xpilot 15345/tcp # XPilot Contact Port
xpilot 15345/udp
wnn6 22273/tcp # wnn6
wnn6 22273/udp
binkp 24554/tcp # Bink fidonet protocol
binkp 24554/udp
quake 26000/tcp # Quake @!#
quake 26000/udp
wnn6-ds 26208/tcp
wnn6-ds 26208/udp
traceroute 33434/tcp # traceroute use
traceroute 33434/udp
#=========================================================================
# The remaining port numbers are not as allocated by IANA.
# Kerberos (Project Athena/MIT) services
# Note that these are for Kerberos v4, and are unofficial
kerberos_master 751/tcp # Kerberos authentication
kerberos_master 751/udp
passwd_server 752/tcp # Kerberos passwd server
passwd_server 752/udp
krb_prop 754/tcp # Kerberos slave propagation
krbupdate 760/tcp kreg # Kerberos registration
kpop 1109/tcp # Pop with Kerberos
knetd 2053/tcp # Kerberos de-multiplexor
eklogin 2105/tcp # Kerberos encrypted rlogin
# CVSup support http://www.cvsup.org/
supfilesrv 871/tcp # SUP server
supfiledbg 1127/tcp # SUP debugging
# Datagram Delivery Protocol services
rtmp 1/ddp # Routing Table Maintenance Protocol
nbp 2/ddp # Name Binding Protocol
echo 4/ddp # AppleTalk Echo Protocol
zip 6/ddp # Zone Information Protocol
# Many services now accepted as 'standard'
linuxconf 98/tcp # LinuxConf
smtps 465/tcp ssmtp # smtp protocol over TLS/SSL
smtps 465/udp ssmtp
swat 901/tcp # Samba configuration tool
rndc 953/tcp # rndc control sockets (BIND 9)
rndc 953/udp
skkserv 1178/tcp # SKK Japanese input method
xtel 1313/tcp # french minitel
support 1529/tcp # GNATS
cfinger 2003/tcp lmtp # GNU Finger
ninstall 2150/tcp # ninstall service
ninstall 2150/udp
afbackup 2988/tcp # Afbackup system
afbackup 2988/udp
fax 4557/tcp # FAX transmission service (old)
noclog 5354/tcp # noclogd with TCP (nocol)
noclog 5354/udp
hostmon 5355/tcp # hostmon uses TCP (nocol)
hostmon 5355/udp
rplay 5555/tcp # RPlay audio service
rplay 5555/udp
canna 5680/tcp # Canna (Japanese Input)
x11-ssh 6010/tcp x11-ssh-offset
x11-ssh 6010/udp x11-ssh-offset
ircd 6667/tcp # Internet Relay Chat
ircd 6667/udp
webcache 8080/tcp # WWW caching service
webcache 8080/udp
tproxy 8081/tcp # Transparent Proxy
tproxy 8081/udp
jetdirect 9100/tcp #HP JetDirect card
jetdirect 9100/udp
mandelspawn 9359/udp mandelbrot # network mandelbrot
kamanda 10081/tcp # amanda backup services (Kerberos)
kamanda 10081/udp
amandaidx 10082/tcp # amanda backup services
amidxtape 10083/tcp # amanda backup services
isdnlog 20011/tcp # isdn logging system
isdnlog 20011/udp
vboxd 20012/tcp # voice box system
vboxd 20012/udp
wnn4_Cn 22289/tcp wnn6_Cn # Wnn (Chinese input)
wnn4_Kr 22305/tcp wnn6_Kr # Wnn (Korean input)
wnn4_Tw 22321/tcp wnn6_Tw # Wnn (Taiwanse input)
asp 27374/tcp # Address Search Protocol
asp 27374/udp
tfido 60177/tcp # Ifmail
tfido 60177/udp
fido 60179/tcp # Ifmail
fido 60179/udp
# Local services

42
shadow Normal file
View File

@ -0,0 +1,42 @@
root::13364:0:::::
bin:!:13364:0:::::
daemon:!:13364:0:::::
adm:!:13364:0:::::
lp:!:13364:0:::::
sync:!:13364:0:::::
shutdown:!:13364:0:::::
halt:!:13364:0:::::
mail:!:13364:0:::::
news:!:13364:0:::::
uucp:!:13364:0:::::
operator:!:13364:0:::::
man:!:13364:0:::::
postmaster:!:13364:0:::::
cron:!:13364:0:::::
ftp:!:13364:0:::::
sshd:!:13364:0:::::
at:!:13364:0:::::
squid:!:13364:0:::::
gdm:!:13364:0:::::
xfs:!:13364:0:::::
games:!:13364:0:::::
named:!:13364:0:::::
mysql:!:13364:0:::::
postgres:!:13364:0:::::
apache:!:13364:0:::::
nut:!:13364:0:::::
cyrus:!:13364:0:::::
vpopmail:!:13364:0:::::
alias:!:13364:0:::::
qmaild:!:13364:0:::::
qmaill:!:13364:0:::::
qmailp:!:13364:0:::::
qmailq:!:13364:0:::::
qmailr:!:13364:0:::::
qmails:!:13364:0:::::
postfix:!:13364:0:::::
smmsp:!:13364:0:::::
portage:!:13364:0:::::
guest:!:13364:0:::::
nobody:!:13364:0:::::
distcc:!:13364:0:::::

7
shells Normal file
View File

@ -0,0 +1,7 @@
# valid login shells
/bin/ash
/bin/dash
#/bin/bash
#/bin/lash
#/bin/msh

30
src/Makefile Normal file
View File

@ -0,0 +1,30 @@
CC = gcc
LD = gcc
#BIN_TARGETS = splashbard
#SBIN_TARGETS = runscript start-stop-daemon
SBIN_TARGETS = runscript
TARGET = $(BIN_TARGETS) $(SBIN_TARGETS)
.PHONY: all clean
all: $(TARGET)
tsplashd: splashbard.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
runscript: runscript.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
start-stop-daemon: start-stop-daemon.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f $(TARGET) *.o core *~
install: $(TARGET)
install -m 0755 -d $(DESTDIR)/bin
install -m 0755 -d $(DESTDIR)/sbin
# install -m 0755 $(BIN_TARGETS) $(DESTDIR)/bin
install -m 0755 $(SBIN_TARGETS) $(DESTDIR)/sbin

26
src/headers.h Normal file
View File

@ -0,0 +1,26 @@
/*
* header.h
* Dirty little file to include header files w/out autotools.
*
* Copyright 1999-2004 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
* $Header$
*/
/* Common includes */
#define HAVE_TIOCNOTTY
#define HAVE_SETSID
/* OS-specific includes */
#if defined(__linux__)
# define HAVE_SYS_SYSMACROS_H
# define HAVE_ERROR_H
#endif
/* Now we actually include crap ;) */
#ifdef HAVE_ERROR_H
# include <error.h>
#endif
#ifdef HAVE_SYS_SYSMACROS_H
# include <sys/sysmacros.h>
#endif

25
src/runscript.c Normal file
View File

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#define MAXARGS 32
int main(int argc, char *argv[]) {
char *av[MAXARGS];
int i;
char *runscriptsh;
if (!(runscriptsh = getenv("RUNSCRIPT")))
runscriptsh = "/sbin/runscript-alpine.sh";
for (i = 0; i < argc && i < MAXARGS ; i++) {
av[i] = argv[i];
}
av[i] = NULL;
if (execv(runscriptsh, av) < 0) {
perror("execv");
return -1;
}
return 0;
}

215
src/splashbard.c Normal file
View File

@ -0,0 +1,215 @@
/*
Splash daemon
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
char unfilled[64] = " ";
char filled[64] = "=";
char leftborder[64] = "[";
char rightborder[64] = "]";
char animation[64] = "\\|/-";
char message[128] = "SplashD";
int width = 78;
int delay = 50000;
int steps = 10;
char sigusr1 = 0;
char sigusr2 = 0;
char sigterm = 0;
const char options[] = "a:d:f:l:m:r:u:";
void usage(int exitcode) {
fprintf(stderr, "Usage: splashd [-adflru] [OPTION] STEPS\n");
exit(exitcode);
}
int parse_args(int argc, char *argv[]) {
int c;
while ((c = getopt(argc, argv, options)) > 0) {
switch(c) {
case 'a': {
strncpy(animation, optarg, sizeof(animation));
break;
}
case 'd': {
delay = atoi(optarg);
break;
}
case 'f': {
strncpy(filled, optarg, sizeof(filled));
break;
}
case 'l': {
strncpy(leftborder, optarg, sizeof(leftborder));
break;
}
case 'm': {
strncpy(message, optarg, sizeof(message));
break;
}
case 'r': {
strncpy(rightborder, optarg, sizeof(rightborder));
break;
}
case 'u': {
strncpy(unfilled, optarg, sizeof(unfilled));
break;
}
case '?':
default: {
usage(1);
break;
}
}
}
if (optind != argc-1) usage(1);
return atoi(argv[optind]);
}
void clear_screen(void) {
int i;
for (i=0; i<50; i++) {
printf("\f");
}
printf("\n");
}
void center(char *s) {
int i;
printf("\n");
for (i=0; i < (80-strlen(s)) /2; i++) putchar(' ');
printf("%s", s);
}
void draw_bar(int steps, char *msg) {
int i=0;
char bar[256];
char *p = bar;
int size=sizeof(bar);
if (steps >= 78) steps=78;
for (i=0; i < 20; i++) printf("\n");
p += snprintf(p, (size =- strlen(leftborder)), "%s", leftborder);
for (i=0; i < steps; i++) {
p += snprintf(p, (size =-strlen(unfilled)), "%s", unfilled);
}
p += snprintf(p, (size =- strlen(rightborder)), "%s", rightborder);
center(msg);
printf("\n");
center(bar);
for (i=0; i<steps+1; i++) putchar('\b');
fflush(stdout);
}
void sig_handler(int signo) {
signal(signo, sig_handler);
switch(signo) {
case SIGUSR1: {
sigusr1 = 1;
break;
}
case SIGUSR2: {
sigusr2 = 1;
break;
}
case SIGTERM: {
sigterm = 1;
break;
}
default:
exit(0);
}
}
void fill_barstr(char *buf, size_t totsize,
int current, int steps, char curs) {
int i = 0;
int lbsize = strlen(leftborder);
int rbsize = strlen(rightborder);
int barsize = totsize - lbsize - rbsize;
int fillcount = current * barsize / steps;
int fillsize = strlen(filled) * fillcount;
char *bar = buf + lbsize;
if (totsize < lbsize + rbsize + 1) return;
strncpy(buf, leftborder, totsize);
memset(bar, unfilled[0], barsize);
memset(bar, filled[0], fillcount);
strncpy(bar + barsize, rightborder, totsize - rbsize);
if ( current < steps) bar[fillcount] = curs;
}
void run_animation(int steps) {
int current = 0;
int i=0;
char buf[256];
while (current < steps && sigterm == 0) {
fill_barstr(buf, width, current, steps, animation[i]);
i = (i + 1) % strlen(animation);
printf("\r%s", buf);
usleep(delay);
if (sigusr1) {
sigusr1 = 0;
current++;
}
fflush(stdout);
}
fill_barstr(buf, width, steps, steps, animation[i]);
printf("\r%s", buf);
fflush(stdout);
}
int main(int argc, char *argv[]) {
int steps;
steps = parse_args(argc, argv);
/* clear screen */
// clear_screen();
/* fork */
if (fork()) {
exit(0);
}
/* attatch to signal handler */
signal(SIGUSR1, sig_handler);
signal(SIGTERM, sig_handler);
run_animation(steps);
printf("\n\n");
return 0;
}

1375
src/start-stop-daemon.c Normal file

File diff suppressed because it is too large Load Diff

12
subdir_dev Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# scripts that moves devices to the $1/ subdir.
if [ "$ACTION" = remove ] ; then
mv $1/$MDEV $MDEV
rmdir $1 2>/dev/null
else
mkdir -p $1
mv $MDEV $1
fi

6
sysctl.conf Normal file
View File

@ -0,0 +1,6 @@
net.ipv4.ip_forward = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
kernel.grsecurity.rand_pids = 1

17
usbdev Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# try to load the proper driver for usb devices
case "$ACTION" in
add|"")
for i in /sys/class/usb_device/$MDEV/device/*/modalias ; do
modprobe `cat $i` 2>/dev/null
done
;;
remove)
for i in /sys/class/usb_device/$MDEV/device/*/modalias ; do
modprobe -r `cat $i` 2>/dev/null
done
esac
# we dont want the ugly usbdev[0-9].[0-9] dev.
rm -f $MDEV