import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
parent
3729fc68eb
commit
423ba10303
13396 changed files with 269468 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-20, 0110 CEST
|
||||
# cconfig: create makefile from conf/ directory
|
||||
# currently: all files
|
||||
# later: only built-defines
|
||||
#
|
||||
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
|
||||
|
||||
echo "#"
|
||||
echo "# Warning: Autogenerated by $0, do not edit. "
|
||||
echo "#"
|
||||
for conf in ${CONFS}; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
value=$(head -n 1 $conf)
|
||||
|
||||
echo "${NAME}=${value}"
|
||||
done
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: build environment to be used in scripts
|
||||
# * Should be sourced by using scripts
|
||||
# 2006-10-26
|
||||
#
|
||||
|
||||
. $(dirname $0)/cinit.read-conf
|
||||
|
||||
export BASEDIR=${DESTDIR}${CINIT_DIR}
|
||||
export SERVICES=${BASEDIR}/${SVCDIR}
|
||||
export CONFIG=${BASEDIR}/${CONFDIR}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: read configuration into variables
|
||||
# Date: 2005-05-24 (Last Changed: 2005-08-08)
|
||||
|
||||
# try environment first
|
||||
if [ "$CINIT_CONF_DIR" ]; then
|
||||
CONFDIR=$CINIT_CONF_DIR
|
||||
elif [ -d $(dirname $0)/../conf/ ]; then
|
||||
CONFDIR=$(dirname $0)/../conf/
|
||||
else
|
||||
echo 'Did not find cinit configuration!' >&2
|
||||
echo "Please set the variable CINIT_CONF_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $CONFDIR
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: install standard sub-configuration directories
|
||||
# Date: 2005-08-07
|
||||
#
|
||||
|
||||
. $(dirname $0)/cinit.build-env
|
||||
|
||||
for svc in $SERVICE_CATEGORIES; do
|
||||
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${SERVICES}/${svc}"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: create header file
|
||||
#
|
||||
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
|
||||
|
||||
echo "/* Warning: Autogenerated by $0, do not edit. */"
|
||||
for conf in $CONFS; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
value=$(head -n 1 $conf)
|
||||
|
||||
# check if numeric: no quotes needed
|
||||
is_numeric=$(echo $value | awk '/^((0[xX])[0-9a-fA-F]+)|([0-9]+)$/ { print }')
|
||||
is_string="$(echo $value | grep '^"')"
|
||||
|
||||
#
|
||||
# Check for quote type
|
||||
#
|
||||
if [ ! "$is_numeric" -a ! "$is_string" ]; then
|
||||
one_char=$(echo -n $value | wc -c)
|
||||
|
||||
if [ "$one_char" -eq 1 ]; then
|
||||
value="'$value'"
|
||||
else
|
||||
# is a string
|
||||
value="\"$value\""
|
||||
fi
|
||||
fi
|
||||
echo "#define" "$NAME" "$value"
|
||||
done
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: read configuration into variables
|
||||
# ~ 2005
|
||||
#
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)
|
||||
|
||||
set -e
|
||||
|
||||
for conf in ${CONFS}/*; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
if eval test -z \$$NAME; then
|
||||
eval $NAME=\"$(head -n 1 $conf)\"
|
||||
eval export $NAME
|
||||
fi
|
||||
# eval echo $NAME = \$$NAME
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
Scripts used to generate or aid in creating a configuration.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Reads list of services to create from stdin
|
||||
# Create services (add correct dependencies)
|
||||
#
|
||||
# Options:
|
||||
# -d: alternate destination directory (instead of /etc/cinit/svc)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Reads list of services to enabled from stdin
|
||||
# Services must already exist
|
||||
#
|
||||
# Options:
|
||||
# -d: alternate destination directory (instead of /etc/cinit/svc)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Search for enabled services:
|
||||
# - /etc/rc.conf
|
||||
# - /usr/local/etc/rc.d/
|
||||
# Output list of services to stdout
|
||||
#
|
||||
# Options:
|
||||
# -r <alternate root directory>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Search all services:
|
||||
# - /etc/rc.conf
|
||||
# - /usr/local/etc/rc.d/
|
||||
# Output list of all services to stdout
|
||||
#
|
||||
# Options:
|
||||
# -r <alternate root directory>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2006-10-23
|
||||
# cLinux/cinit
|
||||
|
||||
. $(dirname $0)/cinit.build-env
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p "${BASEDIR}"
|
||||
|
||||
mkdir -p "${SERVICES}"
|
||||
mkdir -p "${SERVICES}/${C_INIT}"
|
||||
|
||||
mkdir -p "${CONFIG}"
|
||||
|
|
@ -0,0 +1 @@
|
|||
Only to be used by Nico Schottelius.
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# Build release tar
|
||||
# Date: Sat Oct 15 21:38:29 CEST 2005
|
||||
# Last Changed: ls -l
|
||||
|
||||
# only release if I tell it to release
|
||||
[ "$1" = "now" ] || exit 23
|
||||
|
||||
#if [ $# -ne 2 ]; then
|
||||
# echo "This is a maintainer-only script to release cinit"
|
||||
# echo $(basename $0): source-dir version
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
# paths
|
||||
DIR="$(cd $(dirname $0)/../../; pwd -P)"
|
||||
DDIR="$(cd $(dirname $0)/../../../; pwd -P)"
|
||||
RDIR=$(basename "$DIR")
|
||||
|
||||
# version
|
||||
VERSION="$(cd "$DIR"; pwd -P | sed 's;.*/cinit-;;')"
|
||||
VERSION_CONF="$(head -n1 $(dirname $0)/../../conf/version | sed 's/^"\(.*\)"$/\1/')"
|
||||
VERSION_CHANGES="$(head -n1 "$(dirname $0)/../../CHANGES" | sed 's/cinit-\(.*\):.*/\1/')"
|
||||
OUT_NAME="cinit-${VERSION}.tar.bz2"
|
||||
|
||||
# remote
|
||||
D_HOST=home.schottelius.org
|
||||
D_BASE=www/org/schottelius/unix/www/cinit
|
||||
D_DIR=${D_BASE}/archives/
|
||||
D_SOURCE=${D_BASE}/browse_source/
|
||||
LINK=current
|
||||
|
||||
echo "=> Version directory: $VERSION"
|
||||
echo "=> Version conf/version: $VERSION_CONF"
|
||||
echo "=> Version CHANGES: $VERSION_CHANGES"
|
||||
|
||||
if [ "$VERSION" = "$VERSION_CONF" -a "$VERSION" = "$VERSION_CHANGES" ]; then
|
||||
echo "=> Version confirmed."
|
||||
else
|
||||
echo "*** VERSION MISMATCH ***"
|
||||
exit 42
|
||||
fi
|
||||
|
||||
echo -n "=> Continue? "
|
||||
read yes
|
||||
|
||||
if [ ! -d "$DIR" ]; then
|
||||
echo "$DIR is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# do the work!
|
||||
( cd "$DIR" && make dist ) || exit 1
|
||||
|
||||
echo "Creating bzip2 compressed tar"
|
||||
cd $DDIR
|
||||
tar cj -X $DIR/.exclude -f "$OUT_NAME" "$RDIR"
|
||||
chmod 0644 "$OUT_NAME"
|
||||
|
||||
echo "Transfering to $D_HOST"
|
||||
scp "$OUT_NAME" "$D_HOST:$D_DIR"
|
||||
|
||||
echo "Extracting to $D_SOURCE"
|
||||
ssh "$D_HOST" "tar xfj $D_DIR/$OUT_NAME -C $D_SOURCE"
|
||||
|
||||
echo "Correcting paranoid permissions"
|
||||
ssh "$D_HOST" "find \"$D_SOURCE/$RDIR\" -type f -exec chmod 0644 {} \\;"
|
||||
ssh "$D_HOST" "find \"$D_SOURCE/$RDIR\" -type d -exec chmod 0755 {} \\;"
|
||||
ssh "$D_HOST" "cd \"$D_SOURCE\" && rm -f \"$LINK\" && ln -s \"$RDIR\" \"$LINK\""
|
||||
|
||||
echo "Please do not forget to update the website..."
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# yah - yet another hack
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "HOSTNAME"
|
||||
exit 23
|
||||
fi
|
||||
|
||||
host="$1"
|
||||
|
||||
hier=$(dirname $0)
|
||||
|
||||
$hier/compile_test.sh "$host"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "aborting, did not compile on $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ssh "${host}" './cinit/src/cinit & (sleep 30; kill -9 $(pgrep cinit))'
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# just a hack
|
||||
|
||||
dir=$(dirname $0)
|
||||
|
||||
sys=$(uname -s)
|
||||
sys_small=$(echo $sys | tr '[A-Z]' '[a-z]')
|
||||
|
||||
case $(uname -s) in
|
||||
NetBSD|OpenBSD)
|
||||
make=gmake
|
||||
;;
|
||||
*)
|
||||
make=make
|
||||
;;
|
||||
esac
|
||||
|
||||
cd "${dir}/../../"
|
||||
echo $sys_small > conf/os
|
||||
# automatically called by make..
|
||||
#./bin/cinit.configure.os
|
||||
|
||||
cd "src"
|
||||
$make clean
|
||||
$make cinit
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
what=$(dirname $0)/../../
|
||||
what_real=$(cd "$what" && pwd -P)
|
||||
dest=~compiler/cinit-test
|
||||
|
||||
set -e
|
||||
sudo rsync -av "${what_real}/" "$dest"
|
||||
sudo chown -R compiler "$dest"
|
||||
sudo -u compiler "${dest}/scripts/internal/compile_local.sh"
|
||||
sudo -u compiler "${dest}/src/cinit" &
|
||||
sleep 13
|
||||
sudo -u compiler "${dest}/scripts/internal/stop_cinit.sh"
|
||||
|
||||
# exit 0 for make
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
# yah - yet another hack
|
||||
|
||||
host="$1"
|
||||
what=$(dirname $0)/../../
|
||||
|
||||
rsync --exclude .git --exclude \*.o -av "${what}" "${host}:cinit"
|
||||
ssh "${host}" "./cinit/scripts/internal/compile_local.sh"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
hier=$(dirname $0)
|
||||
|
||||
set -e
|
||||
${hier}/../cinit.install.standard.dirs
|
||||
cat > /etc/cinit/svc/init/on << eof
|
||||
#!/bin/sh
|
||||
echo test1
|
||||
sleep 4
|
||||
echo test2 - \$@
|
||||
eof
|
||||
chmod 0755 /etc/cinit/svc/init/on
|
||||
|
||||
cat > /etc/cinit/svc/init/on.params << eof
|
||||
es
|
||||
scheint
|
||||
zu
|
||||
gehen
|
||||
eof
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
src="$(dirname $0)/../../"
|
||||
src_abs=$(cd "$src" && pwd -P)
|
||||
|
||||
for commit in $( git log --pretty=short | awk '/^commit/ { print $2 }'); do
|
||||
set -e
|
||||
cd "$src_abs"
|
||||
temp=$(mktemp -d /tmp/cinit.XXXXXXXXXX)
|
||||
git-archive --format=tar "$commit" | ( cd "$temp"; tar x )
|
||||
cd "${temp}/src"
|
||||
set +e
|
||||
make clean && make cinit && ./cinit
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "Commit $commit is ok"
|
||||
exit 0
|
||||
fi
|
||||
echo "Broken $commit"
|
||||
sleep 1
|
||||
set -e
|
||||
rm -rf "$temp"
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
# Linux specific, but don't care, I am the only person that should use it
|
||||
|
||||
killall -TERM cinit
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# yah
|
||||
|
||||
hosts="penrose.bsdprojects.net bot.unixkiste.org suckz.eu jiffies.forkbomb.ch"
|
||||
|
||||
set -e
|
||||
|
||||
for host in $hosts; do
|
||||
echo "$1 on $host"
|
||||
"$1" "$host" | sed "s/^/${host}: /"
|
||||
echo "==> Finished $host"
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --leak-resolution=high ./cinit
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2006-12-08
|
||||
# Report compile success
|
||||
#
|
||||
|
||||
echo "cinit compile success report"
|
||||
echo "----------------------------"
|
||||
"$(dirname $0)/cinit.mkheader"
|
||||
echo "----------------------------"
|
||||
uname -a
|
||||
echo "----------------------------"
|
||||
. "$(dirname $0)/cinit.read-conf"
|
||||
echo '$CC'
|
||||
"$CC" -v
|
||||
echo "----------------------------"
|
||||
echo -n "Size: "
|
||||
ls -l "$(dirname $0)/../src/cinit"
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius (nico-cinit /at/ schottelius.org)
|
||||
# 2007-05-21
|
||||
# Behave as being shutdown from Linux' sysvinit
|
||||
|
||||
# parse options, display usage
|
||||
|
||||
# all the functions
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
cat << cinit_usage
|
||||
|
||||
*** cinit linux-sysvinit shutdown wrapper ***
|
||||
|
||||
Usage shutdown [-akrhHPfnc] [-t secs] time [warning message]
|
||||
-a: use /etc/shutdown.allow
|
||||
-k: don't really shutdown, only warn.
|
||||
-r: reboot after shutdown.
|
||||
-h: halt after shutdown.
|
||||
-P: halt action is to turn off power.
|
||||
-H: halt action is to just halt.
|
||||
-f: do a 'fast' reboot (skip fsck).
|
||||
-F: Force fsck on reboot.
|
||||
-n: do not go through "init" but go down real fast.
|
||||
-c: cancel a running shutdown.
|
||||
-t secs: delay between warning and kill signal.
|
||||
** the "time" argument is mandatory! (try "now") **
|
||||
|
||||
You can also call "cmd" directly instead of using this wrapper.
|
||||
|
||||
cinit_usage
|
||||
|
||||
}
|
||||
|
||||
# the main part
|
||||
usage
|
||||
Loading…
Add table
Add a link
Reference in a new issue