add cinit-0.3pre15
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
parent
36de902919
commit
440caeb555
1013 changed files with 99995 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
Scripts for internal use.
|
||||
|
||||
Users: Use bin/ for usable helper programs.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius, 2006-07-28
|
||||
#
|
||||
# cinit: configure the ipc method to use
|
||||
#
|
||||
|
||||
HIER=$(dirname $0)
|
||||
DDIR=$HIER/../../src/ipc
|
||||
DFILE=${DDIR}/current
|
||||
IPC_METHOD=$(head -n 1 "$HIER/../../conf/ipc_method")
|
||||
|
||||
echo "Configure: IPC: Using \"$IPC_METHOD\" as IPC method"
|
||||
|
||||
# always remove link before, as ln seems to be broken
|
||||
# Doing ln -sf src/ipc/$method current twice, will create the file
|
||||
# "current" _BELOW_ src/ipc/$method and not overwrite the link
|
||||
# src/ipc/current
|
||||
|
||||
rm -f "${DFILE}"
|
||||
ln -sf "${IPC_METHOD}" "${DFILE}"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: touch a file to mark everything configured
|
||||
# 2006-08-27
|
||||
#
|
||||
|
||||
echo "Configure: MK: Marking directory as configured"
|
||||
touch .configured
|
||||
15
software/cinit/browse_source/cinit-0.3pre15/scripts/build/cinit.configure.os
Executable file
15
software/cinit/browse_source/cinit-0.3pre15/scripts/build/cinit.configure.os
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: setups symlinks for the os
|
||||
#
|
||||
|
||||
DDIR=$(dirname $0)/../../src/os
|
||||
DFILE="$DDIR/current"
|
||||
OSCONFIG=$(dirname $0)/../../conf/os
|
||||
|
||||
OS=$(head -n 1 "$OSCONFIG")
|
||||
|
||||
echo "Configure: OS: Binaries are created for $OS ..."
|
||||
|
||||
rm -f "${DFILE}"
|
||||
ln -sf "${OS}" "${DFILE}"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: setups scripts for compiling and linking
|
||||
#
|
||||
|
||||
HIER=$(dirname $0)
|
||||
DDIR=$HIER/../../tmpbin/
|
||||
CC=$(head -n 1 "$HIER/../../conf/cc")
|
||||
CFLAGS=$(head -n 1 "$HIER/../../conf/cflags")
|
||||
LD=$(head -n 1 "$HIER/../../conf/ld")
|
||||
LDFLAGS=$(head -n 1 "$HIER/../../conf/ldflags")
|
||||
STRIP=$(head -n 1 "$HIER/../../conf/strip")
|
||||
|
||||
echo "Configure: CC: Creating cc, ld and strip ..."
|
||||
|
||||
mkdir -p "$DDIR"
|
||||
cd "$DDIR"
|
||||
|
||||
echo "$CC $CFLAGS \"\$@\"" > cc
|
||||
echo "$LD $LDFLAGS \"\$@\"" > ld
|
||||
echo "$STRIP \"\$@\"" > strip
|
||||
|
||||
# set correct permissions
|
||||
chmod 0700 *
|
||||
20
software/cinit/browse_source/cinit-0.3pre15/scripts/cconfig.mk.makefile
Executable file
20
software/cinit/browse_source/cinit-0.3pre15/scripts/cconfig.mk.makefile
Executable file
|
|
@ -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
|
||||
12
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.build-env
Executable file
12
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.build-env
Executable file
|
|
@ -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}
|
||||
17
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.get-confdir
Executable file
17
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.get-confdir
Executable file
|
|
@ -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
|
||||
32
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.mkheader
Executable file
32
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.mkheader
Executable file
|
|
@ -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
|
||||
18
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.read-conf
Executable file
18
software/cinit/browse_source/cinit-0.3pre15/scripts/cinit.read-conf
Executable file
|
|
@ -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>
|
||||
15
software/cinit/browse_source/cinit-0.3pre15/scripts/create_baseconfig.sh
Executable file
15
software/cinit/browse_source/cinit-0.3pre15/scripts/create_baseconfig.sh
Executable file
|
|
@ -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.
|
||||
80
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/cinit.release
Executable file
80
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/cinit.release
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# Build release tar
|
||||
# Date: Sat Oct 15 21:38:29 CEST 2005
|
||||
# Last Changed: ls -l
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "This is a maintainer-only script to release cinit"
|
||||
echo $(basename $0): version
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# paths
|
||||
D_BASE="/home/users/nico/privat/computer/net/netzseiten/www.nico.schottelius.org/src/software/cinit"
|
||||
D_DIR=${D_BASE}/archives/
|
||||
D_SOURCE=${D_BASE}/browse_source/
|
||||
|
||||
# versions to check
|
||||
VERSION_CONF="$(head -n1 $(dirname $0)/../../conf/version | sed 's/^"\(.*\)"$/\1/')"
|
||||
VERSION_ARGV="$1"
|
||||
VERSION_GIT="$(git describe)"
|
||||
|
||||
echo "=> Version commandline: $VERSION_ARGV"
|
||||
echo "=> Version conf/version: $VERSION_CONF"
|
||||
echo "=> Version git: $VERSION_GIT"
|
||||
|
||||
if [ "$VERSION_ARGV" = "$VERSION_CONF" -a "$VERSION_ARGV" = "$VERSION_GIT" ]; then
|
||||
echo "=> Version confirmed."
|
||||
else
|
||||
echo "*** VERSION MISMATCH ***"
|
||||
exit 42
|
||||
fi
|
||||
|
||||
# Finally, accept the right version
|
||||
VERSION="$VERSION_GIT"
|
||||
NAME="cinit-${VERSION}"
|
||||
TARNAME="cinit-${VERSION}.tar.bz2"
|
||||
TARPATH="$D_DIR/$TARNAME"
|
||||
|
||||
echo -n "=> Continue to release $NAME? "
|
||||
read yes
|
||||
|
||||
git archive $VERSION --prefix="${NAME}/" --output="${TARPATH}"
|
||||
( cd "$D_SOURCE" && tar xvf "$TARPATH" )
|
||||
|
||||
echo "Please do not forget to update the website..."
|
||||
|
||||
################################################################################
|
||||
# Unused, but interesting
|
||||
|
||||
# make sure the examples are not executed anymore
|
||||
exit 0
|
||||
|
||||
# match cinit-$version as directory name
|
||||
VERSION_DIR="$(cd "$DIR"; pwd -P | sed 's;.*/cinit-;;')"
|
||||
|
||||
# grep version string from CHANGES file (often used, obsoleted here)
|
||||
VERSION_CHANGES="$(head -n1 "$(dirname $0)/../../CHANGES" | sed 's/cinit-\(.*\):.*/\1/')"
|
||||
|
||||
# Correct umask 077 results
|
||||
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\""
|
||||
|
||||
# Create archive
|
||||
echo "Creating bzip2 compressed tar"
|
||||
cd $DDIR
|
||||
tar cj -X $DIR/.exclude -f "$OUT_NAME" "$RDIR"
|
||||
chmod 0644 "$OUT_NAME"
|
||||
|
||||
# Transfer to a remote host
|
||||
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"
|
||||
|
||||
|
||||
|
||||
20
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/compile+run.sh
Executable file
20
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/compile+run.sh
Executable file
|
|
@ -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
|
||||
67
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/indent_script
Executable file
67
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/indent_script
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius (nico-linux at schottelius.org)
|
||||
# indents like kr with a little bit more beauty look
|
||||
# 13-May-2004
|
||||
# written for the monotone project, adapted for all my projects
|
||||
#
|
||||
# Copying: GPLv3
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "$0: <files to indent>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
opts=""
|
||||
opts="${opts} -bap" # --blank-lines-after-procedures
|
||||
opts="${opts} -bbb" # --blank-lines-before-block-comments
|
||||
opts="${opts} -bad" # --blank-lines-after-declarations
|
||||
opts="${opts} -bbo" # --break-before-boolean-operator
|
||||
opts="${opts} -br" # --braces-on-if-line
|
||||
opts="${opts} -brs" # --braces-on-struct-decl-line
|
||||
opts="${opts} -cdb" # --comment-delimiters-on-blank-lines
|
||||
opts="${opts} -cbi0" # --case-brace-indentation
|
||||
opts="${opts} -cdw" # --cuddle-do-while
|
||||
opts="${opts} -ce" # --cuddle-else, see -br
|
||||
opts="${opts} -ci0" # --continuation-indentation (see -lp)
|
||||
opts="${opts} -cli3" # --case-indentation
|
||||
opts="${opts} -cp33" # --else-endif-columnn
|
||||
opts="${opts} -cs" # --space-after-cast
|
||||
opts="${opts} -d0" # --line-comments-indentationn
|
||||
opts="${opts} -di0" # --declaration-indentation
|
||||
opts="${opts} -fca" # --format-all-comments
|
||||
opts="${opts} -hnl" # --honour-newlines
|
||||
opts="${opts} -i3" # --indent-level
|
||||
opts="${opts} -ip0" # --parameter-indentation
|
||||
opts="${opts} -l80" # --line-length
|
||||
opts="${opts} -lc80" # --line-length
|
||||
opts="${opts} -lp" # --continue-at-parentheses
|
||||
opts="${opts} -lps" # --leave-preprocessor-space
|
||||
opts="${opts} -nbc" # --no-blank-lines-after-commas
|
||||
opts="${opts} -nbfda" # --dont-break-function-decl-args
|
||||
opts="${opts} -nbfde" # NOT --break-function-decl-args
|
||||
opts="${opts} -nfc1" # --dont-format-first-column-comments
|
||||
opts="${opts} -npcs" # --no-space-after-function-call-names
|
||||
opts="${opts} -nprs" # --no-space-after-parentheses
|
||||
opts="${opts} -npsl" # --dont-break-procedure-type
|
||||
opts="${opts} -nsaf" # --no-space-after-for
|
||||
opts="${opts} -nsai" # --no-space-after-if
|
||||
opts="${opts} -nsaw" # --no-space-after-while
|
||||
opts="${opts} -npsl" # --dont-break-procedure-type
|
||||
opts="${opts} -nut" # --no-tabs
|
||||
opts="${opts} -nv" # --no-verbosity
|
||||
opts="${opts} -npro" # --ignore-profile
|
||||
opts="${opts} -pi0" # --paren-indentationn
|
||||
opts="${opts} -ppi3" # preprocessor indent
|
||||
opts="${opts} -sbi0" # --struct-brace-indentation
|
||||
opts="${opts} -sc" # --start-left-side-of-comments
|
||||
opts="${opts} -sob" # --swallow-optional-blank-lines
|
||||
opts="${opts} -ss" # --space-special-semicolon
|
||||
|
||||
|
||||
|
||||
for file in "$@"; do
|
||||
indent $opts "$file"
|
||||
done
|
||||
# old:
|
||||
# -ad \
|
||||
# -ts3 -nut -sc -ce -cdw -cli0 -nbc lp -ppi3 -di1 -c33 -cd33 -ncdb -ci3 -cp33 -cs -d0 -di0 -l75 -nfc1 -nfca -hnl -ip0 -nprs -saf -sai -saw -nsob -nss -npsl "$file"
|
||||
57
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/old/cdoc-man.sh
Executable file
57
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/old/cdoc-man.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Nico Schottelius <nico-linux@schottelius.org>
|
||||
# Date: 21-Aug-2005
|
||||
# Last Modified: -
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
[ $# -ne 1 ] && exit 23
|
||||
|
||||
SRC=$1
|
||||
|
||||
cd "$SRC"
|
||||
|
||||
#
|
||||
# Title heading
|
||||
#
|
||||
echo .TH $(cat "meta/name" "meta/man_section" "meta/date")
|
||||
|
||||
#
|
||||
# Name
|
||||
#
|
||||
echo .SH NAME
|
||||
echo $(cat meta/name) - $(cat meta/short_description)
|
||||
|
||||
#
|
||||
# Synopsis
|
||||
#
|
||||
echo .SH SYNOPSIS
|
||||
echo $(cat path) $(cat parameters)
|
||||
|
||||
#
|
||||
# description
|
||||
#
|
||||
echo .SH DESCRIPTION
|
||||
echo $(cat long_description)
|
||||
|
||||
#
|
||||
# availability
|
||||
#
|
||||
for section in availability examples "see also" author; do
|
||||
if [ -f "$section" ]; then
|
||||
echo .SH $section | tr '[a-z]' '[A-Z]'
|
||||
cat "$section"
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# files
|
||||
#
|
||||
if [ -f files ]; then
|
||||
echo .SH FILES
|
||||
cat files | sed 's/\(.*\)/.IP "\1" /'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
22
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/qemu-test.sh
Executable file
22
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/qemu-test.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-09-03: For testing cinit in qemu
|
||||
#
|
||||
|
||||
emud="${HOME}/emu"
|
||||
img="${emud}/debian-hd.img"
|
||||
ddir="${emud}/mount"
|
||||
loop=/dev/loop1
|
||||
fsck="/sbin/fsck.jfs"
|
||||
|
||||
# my jfs is on the first partition, 512*63 bytes offset
|
||||
offset="32256"
|
||||
|
||||
set -e
|
||||
set -x
|
||||
sudo losetup -o "${offset}" "${loop}" "${img}"
|
||||
sudo "${fsck}" "${loop}"
|
||||
sudo mount "${loop}" "${ddir}"
|
||||
|
||||
sudo umount "${loop}"
|
||||
sudo losetup -d "${loop}"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
# Linux specific, but don't care, I am the only person that should use it
|
||||
|
||||
killall -TERM cinit
|
||||
11
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/test-cmd.sh
Executable file
11
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/test-cmd.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-09-27: Test cmd
|
||||
#
|
||||
|
||||
|
||||
echo "Testing cmd..."
|
||||
sudo /sbin/cmd -s /etc/cinit/svc/init
|
||||
sudo /sbin/cmd -p /etc/cinit/svc/init
|
||||
sudo /sbin/cmd -v
|
||||
sudo /sbin/cmd -V
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# build, install and test cinit in an uml image
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
###################### Params ########################################
|
||||
# where the cinit source can be found
|
||||
CINIT=/root/cinit-0.1
|
||||
|
||||
# the image you want to put cinit on (I am using gentoo stage3)
|
||||
IMG=stage3-p4.img
|
||||
|
||||
# where to mount the image
|
||||
MNT=/mnt/uml
|
||||
|
||||
# what fsck to use
|
||||
FSCK=fsck.jfs
|
||||
|
||||
# the uml-linux-kernel
|
||||
LINUX=./linux-2.6.11.11
|
||||
|
||||
# parameters to kernel - should not needed to be changed
|
||||
LINUX_PARAM="ubd0=$IMG umid=cinit$$ init=/sbin/cinit"
|
||||
######################################################################
|
||||
HIER=$(pwd)
|
||||
|
||||
|
||||
"$FSCK" "$IMG"
|
||||
mount "$IMG" "$MNT" -o loop
|
||||
echo "$MNT" > "$CINIT/conf/destdir"
|
||||
make -C "$CINIT" clean all install
|
||||
umount "$MNT"
|
||||
|
||||
"$FSCK" "$IMG"
|
||||
"$LINUX" $LINUX_PARAM
|
||||
|
||||
# restore console, if broken
|
||||
#reset
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# yah
|
||||
|
||||
hosts="penrose.bsdprojects.net jiffies.forkbomb.ch ddna044.netstream.ch"
|
||||
|
||||
set -e
|
||||
|
||||
for host in $hosts; do
|
||||
echo "$1 on $host"
|
||||
"$1" "$host" | sed "s/^/${host}: /"
|
||||
echo "==> Finished $host"
|
||||
done
|
||||
1
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/valgrind
Executable file
1
software/cinit/browse_source/cinit-0.3pre15/scripts/internal/valgrind
Executable file
|
|
@ -0,0 +1 @@
|
|||
valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --leak-resolution=high ./cinit
|
||||
18
software/cinit/browse_source/cinit-0.3pre15/scripts/report.compile
Executable file
18
software/cinit/browse_source/cinit-0.3pre15/scripts/report.compile
Executable file
|
|
@ -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,207 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius (nico-cinit /at/ schottelius.org)
|
||||
# 2007-05-21
|
||||
# Behave as being shutdown from Linux' sysvinit
|
||||
|
||||
# Always needed variables / functions
|
||||
_0_short=${0##*/}
|
||||
_o_seperator=":"
|
||||
_oecho_seperator=":"
|
||||
_eecho_seperator=">"
|
||||
|
||||
# ok-exit/echo
|
||||
_oecho()
|
||||
{
|
||||
echo "${_0_short}${_oecho_seperator}" "$@"
|
||||
}
|
||||
|
||||
_oexit()
|
||||
{
|
||||
_oecho "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# error-exit/echo
|
||||
_eecho()
|
||||
{
|
||||
echo "${_0_short}${_oecho_seperator}" "$@" >&2
|
||||
}
|
||||
|
||||
_eexit()
|
||||
{
|
||||
_eecho "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Program specific variables
|
||||
|
||||
time_t=0 # -t sec
|
||||
warn_only_k=0 # -k
|
||||
reboot_r=0 # -r
|
||||
halt_h=0 # -h
|
||||
poweroff_P=0 # -P
|
||||
cancel_c=0 # -c
|
||||
time=-1 # [time]
|
||||
message="" # [warning-message]
|
||||
cmd="" # what to execute internally
|
||||
pidfile="/var/run/cinit.shutdown"
|
||||
pid=""
|
||||
runs=""
|
||||
|
||||
version="0.1"
|
||||
version_date="2007-10-30"
|
||||
|
||||
message_intro="The system is going down for"
|
||||
message_reboot="reboot"
|
||||
message_halt="halt"
|
||||
message_poweroff="poweroff"
|
||||
|
||||
# unimplemented: -a, -H, -f, -F
|
||||
# deprecated and thus not implemented: -n
|
||||
|
||||
# traping signals
|
||||
trap_signals()
|
||||
{
|
||||
_oexit "Aborted shutdown"
|
||||
}
|
||||
|
||||
# all the functions
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
cat << cinit_usage
|
||||
|
||||
*** cinit linux-sysvinit shutdown wrapper (Version ${version} ${version_date}) ***
|
||||
|
||||
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 "cinit.{halt|reboot|poweroff}" directly
|
||||
(instead of using this wrapper).
|
||||
|
||||
cinit_usage
|
||||
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
warn()
|
||||
{
|
||||
( echo ""; echo "$@"; echo "" ) | wall
|
||||
( echo ""; echo "$@"; echo "" )
|
||||
}
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# getopt!
|
||||
while [ "$#" -ge 1 ]; do
|
||||
arg="$1"; shift
|
||||
|
||||
case "${arg}" in
|
||||
-a|-F|-f|-n)
|
||||
_oexit "Sorry, ${arg} is not implemented."
|
||||
;;
|
||||
-t)
|
||||
if [ "$#" -lt 1 ]; then
|
||||
_eexit "-t needs the time argument"
|
||||
fi
|
||||
time_t="$1"; shift
|
||||
;;
|
||||
-k)
|
||||
warn_only_k=1
|
||||
cmd=true
|
||||
;;
|
||||
-r)
|
||||
reboot_r=1
|
||||
cmd=cinit.reboot
|
||||
message_what="${message_reboot}"
|
||||
;;
|
||||
-h|-H)
|
||||
halt_h=1
|
||||
cmd=cinit.halt
|
||||
message_what="${message_halt}"
|
||||
;;
|
||||
-P)
|
||||
poweroff_P=1
|
||||
cmd=cinit.poweroff
|
||||
message_what="${message_poweroff}"
|
||||
;;
|
||||
-c)
|
||||
cancel_c=1
|
||||
;;
|
||||
*)
|
||||
# time unset?
|
||||
if [ "${time}" = -1 ]; then
|
||||
time="${arg}"
|
||||
[ "${time}" = "now" ] && time=0
|
||||
elif [ -z "${message}" ]; then
|
||||
message="${arg}"
|
||||
else
|
||||
_eexit "Already specified time and message"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -f "${pidfile}" ]; then
|
||||
pid=$(cat "${pidfile}")
|
||||
runs=$(kill -CONT "${pid}" >/dev/null 2>&1 && echo yes)
|
||||
fi
|
||||
|
||||
# do cancel or abort or locking
|
||||
if [ "${cancel_c}" -eq 1 ]; then
|
||||
if [ "${runs}" ]; then
|
||||
kill -TERM "${pid}"
|
||||
_oexit "Terminated running shutdown at \"${pid}\"."
|
||||
else
|
||||
_eexit "Cannot abort shutdown, not running."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${time}" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -z "${cmd}" ]; then
|
||||
_eexit "You need to specify one of -h, -P, -H, -r."
|
||||
fi
|
||||
|
||||
# add lock
|
||||
if [ "${pid}" ]; then
|
||||
if [ "${runs}" ]; then
|
||||
_eexit "Shutdown already running."
|
||||
else
|
||||
_oecho "Overwriting stale pidfile"
|
||||
fi
|
||||
fi
|
||||
echo $$ > "${pidfile}"
|
||||
|
||||
if [ "${message}" ]; then
|
||||
warn "${message}"
|
||||
fi
|
||||
|
||||
# signals to abort on
|
||||
trap trap_signals INT HUP TERM
|
||||
|
||||
while [ "${time}" -gt 0 ]; do
|
||||
warn "${message_intro} ${message_what} in ${time} minute(s)."
|
||||
sleep 60
|
||||
time=$((${time}-1))
|
||||
done
|
||||
|
||||
warn "${message_intro} ${message_what} now."
|
||||
"${cmd}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue