initial commit
This commit is contained in:
commit
7891915fdf
5 changed files with 326 additions and 0 deletions
58
create-binfmt-tree.sh
Executable file
58
create-binfmt-tree.sh
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 arch suite rootdir [mirror]"
|
||||||
|
}
|
||||||
|
|
||||||
|
MIRROR="http://127.0.0.1:3142/ftp.de.debian.org/debian"
|
||||||
|
|
||||||
|
[ "$#" -ne 3 ] && [ "$#" -ne 4 ] && { usage; exit; }
|
||||||
|
|
||||||
|
ARCH="$1"
|
||||||
|
SUITE="$2"
|
||||||
|
ROOTDIR="$3"
|
||||||
|
MIRROR=${4:-$MIRROR}
|
||||||
|
|
||||||
|
[ -e "$ROOTDIR" ] && { echo "root directory still exists"; exit; }
|
||||||
|
|
||||||
|
mkdir "$ROOTDIR"
|
||||||
|
|
||||||
|
ROOTDIR=`realpath "$ROOTDIR"`
|
||||||
|
|
||||||
|
# apt options
|
||||||
|
APT_OPTS="-y"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Architecture=$ARCH"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::TrustedParts=$ROOTDIR/etc/apt/trusted.gpg.d"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::Trusted=$ROOTDIR/etc/apt/trusted.gpg"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Get::AllowUnauthenticated=true"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Get::Download-Only=true"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Install-Recommends=false"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir=$ROOTDIR/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc=$ROOTDIR/etc/apt/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::SourceList=$ROOTDIR/etc/apt/sources.list"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::State=$ROOTDIR/var/lib/apt/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::State::Status=$ROOTDIR/var/lib/dpkg/status"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Cache=$ROOTDIR/var/cache/apt/"
|
||||||
|
|
||||||
|
# initial setup for apt and dpkg to work properly
|
||||||
|
mkdir -p $ROOTDIR
|
||||||
|
mkdir -p $ROOTDIR/etc/apt/
|
||||||
|
mkdir -p $ROOTDIR/etc/apt/sources.list.d/
|
||||||
|
mkdir -p $ROOTDIR/etc/apt/preferences.d/
|
||||||
|
mkdir -p $ROOTDIR/var/lib/apt/
|
||||||
|
mkdir -p $ROOTDIR/var/lib/apt/lists/partial/
|
||||||
|
mkdir -p $ROOTDIR/var/lib/dpkg/
|
||||||
|
mkdir -p $ROOTDIR/var/cache/apt/
|
||||||
|
touch $ROOTDIR/var/lib/dpkg/status
|
||||||
|
|
||||||
|
# fill sources.list
|
||||||
|
echo deb $MIRROR $SUITE main > $ROOTDIR/etc/apt/sources.list
|
||||||
|
|
||||||
|
# update and install git and ruby
|
||||||
|
apt-get $APT_OPTS update
|
||||||
|
apt-get $APT_OPTS install libc6 libselinux1 libacl1 man-db libstdc++6
|
||||||
|
|
||||||
|
# unpack downloaded archives
|
||||||
|
for deb in $ROOTDIR/var/cache/apt/archives/*.deb; do
|
||||||
|
dpkg -x $deb $ROOTDIR
|
||||||
|
done
|
23
multistrap-binfmt.conf
Normal file
23
multistrap-binfmt.conf
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[General]
|
||||||
|
arch=
|
||||||
|
directory=
|
||||||
|
cleanup=true
|
||||||
|
unpack=true
|
||||||
|
noauth=true
|
||||||
|
aptsources=Debian
|
||||||
|
bootstrap=Debian
|
||||||
|
allowrecommends=false
|
||||||
|
addimportant=false
|
||||||
|
omitrequired=true
|
||||||
|
|
||||||
|
# libselinux1
|
||||||
|
# libacl1
|
||||||
|
# man-db - man-db
|
||||||
|
# libstdc++6
|
||||||
|
# libfreetype6 - fontconfig
|
||||||
|
# libx11-6 - libgtk2.0-0
|
||||||
|
[Debian]
|
||||||
|
packages=libc6 libselinux1 libacl1 man-db libstdc++6 libfreetype6 libx11-6 libfontconfig1
|
||||||
|
source=http://ftp.de.debian.org/debian
|
||||||
|
suite=sid
|
||||||
|
omitdebsrc=true
|
4
notes
Normal file
4
notes
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
sudo dd if=/dev/zero of=/dev/sdc bs=1M count=1 && echo -ne "c\nu\no\nn\np\n1\n\n\np\nw\n" | sudo fdisk /dev/sdc
|
||||||
|
sudo mkfs.ext3 /dev/sdc1 && sudo mount /dev/sdc1 /mnt && sudo tar -C /mnt -xf debian-sid-armel-2011-06-25.tar && sudo umount /mnt
|
||||||
|
|
||||||
|
SUITE=sid ARCH=armel QEMU_LD_PREFIX=`pwd`/debian-$SUITE-$ARCH-`date +%F` ./polystrap.sh -a $ARCH -s $SUITE -m http://127.0.0.1:3142/cdn.debian.net/debian om-gta02/
|
132
prepare_binfmt_dir.sh
Normal file
132
prepare_binfmt_dir.sh
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# polystrap-binfmt - helps preparing the build host for running polystrap
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 by Geert Stappers <stappers@stappers.nl>
|
||||||
|
#
|
||||||
|
# Polystrap-binfmt is based upon the research of Josch Schauer
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
# FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $( id --user ) -eq 0 ] ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo 1>&2 E: Run this script as root
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo -e "Usage: $0: [-m mirror] architecture directory\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||||
|
LC_ALL=C LANGUAGE=C LANG=C
|
||||||
|
|
||||||
|
while getopts m: opt; do
|
||||||
|
case $opt in
|
||||||
|
m) _MIRROR="$OPTARG";;
|
||||||
|
?) usage; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
|
[ "$#" -ne 2 ] && { echo 1>&2 "E: Two arguments required"; usage; exit 1; }
|
||||||
|
|
||||||
|
ARCH="$1"
|
||||||
|
TMPDIR="$2"
|
||||||
|
|
||||||
|
if [ -d "$TMPDIR" ] ; then
|
||||||
|
TMPDIR="${TMPDIR}/polystrap-binfmt-$$"
|
||||||
|
mkdir $TMPDIR
|
||||||
|
else
|
||||||
|
echo 1>&2 "E: $TMPDIR not an existing directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
[ ! -d "$TMPDIR" ] && { echo 2>&1 "E: Could not create $TMPDIR"; exit 1; }
|
||||||
|
|
||||||
|
MIRROR="http://ftp.nl.debian.org/debian"
|
||||||
|
# overwrite default Debian archive by commandline option
|
||||||
|
MIRROR=${_MIRROR:-$MIRROR}
|
||||||
|
|
||||||
|
MTCNFG=$TMPDIR/multistrap.conf
|
||||||
|
cat << LastLine > $MTCNFG
|
||||||
|
# this is a temporary configuration file for multistrap
|
||||||
|
# it is created by $0
|
||||||
|
# and should also have been deleted by $0
|
||||||
|
#
|
||||||
|
[General]
|
||||||
|
arch=
|
||||||
|
directory=
|
||||||
|
cleanup=true
|
||||||
|
unpack=true
|
||||||
|
noauth=true
|
||||||
|
aptsources=Debian
|
||||||
|
bootstrap=BinfmtStuff
|
||||||
|
allowrecommends=false
|
||||||
|
addimportant=false
|
||||||
|
omitrequired=true
|
||||||
|
|
||||||
|
# shared libraries needed for executing package configuration scripts with qemu
|
||||||
|
# user mode emulation
|
||||||
|
#
|
||||||
|
# man-db to configure man-db
|
||||||
|
# libfreetype6 to configure fontconfig
|
||||||
|
# libx11 to configure libgtk2.0-0
|
||||||
|
[BinfmtStuff]
|
||||||
|
packages=libc6 libselinux1 libacl1 man-db libstdc++6 libfreetype6 libx11-6
|
||||||
|
source=$MIRROR
|
||||||
|
suite=sid
|
||||||
|
omitdebsrc=true
|
||||||
|
# l l
|
||||||
|
LastLine
|
||||||
|
|
||||||
|
[ ! -r "$MTCNFG" ] && { echo 1>&2 "E: Creation of $MTCNFG failed"; exit 1; }
|
||||||
|
|
||||||
|
# download and extract packages with binfmt stuff
|
||||||
|
multistrap -a $ARCH -d $TMPDIR/binfmtroot -f $MTCNFG
|
||||||
|
RETVAL=$?
|
||||||
|
if [ $RETVAL -ne 0 ] ; then
|
||||||
|
echo 1>&2 E: multistrap returned a non zero value
|
||||||
|
echo I: no clean up of temporary files done, the multistrap command was
|
||||||
|
echo I: multistrap -a $ARCH -d $TMPDIR/binfmtroot -f $MTCNFG
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# deduce binfmt architecture from architecture
|
||||||
|
if [ "$ARCH" = $( dpkg --print-architecture ) ]; then
|
||||||
|
BINFMT_ARCH=$ARCH
|
||||||
|
echo W: It is strange to $0 on a $ARCH host for a $BINFMT_ARCH target
|
||||||
|
else
|
||||||
|
case $ARCH in
|
||||||
|
alpha|amd64|arm|armeb|i386|m68k|mips|mipsel\
|
||||||
|
|powerpc|ppc64|sh4|sh4eb|sparc|sparc64)
|
||||||
|
BINFMT_ARCH=$ARCH ;;
|
||||||
|
armel) BINFMT_ARCH=arm ;;
|
||||||
|
lpia) BINFMT_ARCH=i386 ;; # not yet verified FIXME
|
||||||
|
*) echo "unknown architecture: $ARCH"; exit 1;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf /etc/qemu-binfmt/$BINFMT_ARCH
|
||||||
|
cp -r $TMPDIR/binfmtroot /etc/qemu-binfmt/$BINFMT_ARCH
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rm -rf $TMPDIR
|
109
rootstock.sh
Executable file
109
rootstock.sh
Executable file
|
@ -0,0 +1,109 @@
|
||||||
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
# check for fakeroot
|
||||||
|
if [ "$LOGNAME" = "root" ] \
|
||||||
|
|| [ "$USER" = "root" ] \
|
||||||
|
|| [ "$USERNAME" = "root" ] \
|
||||||
|
|| [ "$SUDO_COMMAND" != "" ] \
|
||||||
|
|| [ "$SUDO_USER" != "" ] \
|
||||||
|
|| [ "$SUDO_UID" != "" ] \
|
||||||
|
|| [ "$SUDO_GID" != "" ]; then
|
||||||
|
echo "don't run this script as root - there is no need to"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# modify these
|
||||||
|
ARCH="amd64"
|
||||||
|
DIST="squeeze"
|
||||||
|
MIRROR="http://127.0.0.1:3142/ftp.de.debian.org/debian"
|
||||||
|
DIRECTORY="`pwd`/debian-$DIST-$ARCH-ministrap"
|
||||||
|
|
||||||
|
# re-execute script in fakeroot
|
||||||
|
if [ "$FAKEROOTKEY" = "" ]; then
|
||||||
|
echo "re-executing script inside fakeroot"
|
||||||
|
fakeroot $0;
|
||||||
|
rsync -Phaze ssh $DIRECTORY/ mister-muffin.de:/var/www/
|
||||||
|
ssh mister-muffin.de "chown -R www-data:www-data /var/www/dudle.mister-muffin.de/"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# apt options
|
||||||
|
APT_OPTS="-y"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Architecture=$ARCH"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::TrustedParts=$DIRECTORY/etc/apt/trusted.gpg.d"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::Trusted=$DIRECTORY/etc/apt/trusted.gpg"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Get::AllowUnauthenticated=true"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Get::Download-Only=true"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Apt::Install-Recommends=false"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir=$DIRECTORY/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc=$DIRECTORY/etc/apt/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Etc::SourceList=$DIRECTORY/etc/apt/sources.list"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::State=$DIRECTORY/var/lib/apt/"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::State::Status=$DIRECTORY/var/lib/dpkg/status"
|
||||||
|
APT_OPTS=$APT_OPTS" -o Dir::Cache=$DIRECTORY/var/cache/apt/"
|
||||||
|
|
||||||
|
# clean root directory
|
||||||
|
rm -rf $DIRECTORY
|
||||||
|
|
||||||
|
# initial setup for apt to work properly
|
||||||
|
mkdir -p $DIRECTORY
|
||||||
|
mkdir -p $DIRECTORY/etc/apt/
|
||||||
|
mkdir -p $DIRECTORY/etc/apt/sources.list.d/
|
||||||
|
mkdir -p $DIRECTORY/etc/apt/preferences.d/
|
||||||
|
mkdir -p $DIRECTORY/var/lib/apt/
|
||||||
|
mkdir -p $DIRECTORY/var/lib/apt/lists/partial/
|
||||||
|
mkdir -p $DIRECTORY/var/lib/dpkg/
|
||||||
|
mkdir -p $DIRECTORY/var/cache/apt/
|
||||||
|
# apt somehow needs this file to be present
|
||||||
|
touch $DIRECTORY/var/lib/dpkg/status
|
||||||
|
|
||||||
|
# fill sources.list
|
||||||
|
echo deb $MIRROR $DIST main > $DIRECTORY/etc/apt/sources.list
|
||||||
|
|
||||||
|
# update and install git and ruby
|
||||||
|
apt-get $APT_OPTS update
|
||||||
|
apt-get $APT_OPTS install ruby git-core libgettext-ruby1.8 libjson-ruby1.8
|
||||||
|
|
||||||
|
# unpack downloaded archives
|
||||||
|
for deb in $DIRECTORY/var/cache/apt/archives/*.deb; do
|
||||||
|
dpkg -x $deb $DIRECTORY
|
||||||
|
done
|
||||||
|
|
||||||
|
# delete obsolete directories
|
||||||
|
rm -rf $DIRECTORY/usr/share/
|
||||||
|
rm -rf $DIRECTORY/usr/lib/perl/
|
||||||
|
rm -rf $DIRECTORY/usr/lib/gconv/
|
||||||
|
rm -rf $DIRECTORY/usr/lib/git-core/
|
||||||
|
rm -rf $DIRECTORY/usr/sbin/
|
||||||
|
rm -rf $DIRECTORY/var/
|
||||||
|
rm -rf $DIRECTORY/bin/
|
||||||
|
rm -rf $DIRECTORY/sbin/
|
||||||
|
rm -rf $DIRECTORY/selinux/
|
||||||
|
rm -rf $DIRECTORY/etc/*
|
||||||
|
|
||||||
|
# delete all setuid programs
|
||||||
|
find $DIRECTORY -perm -4000 -delete
|
||||||
|
|
||||||
|
# delete all binaries except for "git" and "ruby"
|
||||||
|
find $DIRECTORY/usr/bin/ -type f -o -type l | egrep -v "ruby|git$" | xargs rm -rf
|
||||||
|
|
||||||
|
# git needs /etc/passwd otherwise git says: "You dont't exist, go away!"
|
||||||
|
cat > $DIRECTORY/etc/passwd << __END__
|
||||||
|
www-data:x:33:33:www-data:/var/www:/bin/sh
|
||||||
|
__END__
|
||||||
|
|
||||||
|
# dont forget to create /tmp directory for dudle
|
||||||
|
mkdir -m 777 $DIRECTORY/tmp
|
||||||
|
|
||||||
|
# get latest dudle
|
||||||
|
bzr branch https://dudle.inf.tu-dresden.de/unstable/ $DIRECTORY/dudle.mister-muffin.de
|
||||||
|
( cd $DIRECTORY/dudle.mister-muffin.de; make; )
|
||||||
|
bzr branch https://dudle.inf.tu-dresden.de/unstable/extensions/dc-net/ $DIRECTORY/dudle.mister-muffin.de/extensions/dc-net/
|
||||||
|
( cd $DIRECTORY/dudle.mister-muffin.de/extensions/dc-net/; make; )
|
||||||
|
|
||||||
|
# fix shebang
|
||||||
|
find $DIRECTORY/dudle.mister-muffin.de/ -type f -regex ".*\.cgi\|.*\.rb" \
|
||||||
|
| xargs sed -i 's/#!\/usr\/bin\/env ruby/#!\/usr\/bin\/ruby/'
|
||||||
|
|
||||||
|
#wget https://dudle.inf.tu-dresden.de/doc/0-register.ogv https://dudle.inf.tu-dresden.de/doc/1-setup.ogv https://dudle.inf.tu-dresden.de/doc/2-participate.ogv
|
||||||
|
#mv 0-register.ogv 1-setup.ogv 2-participate.ogv $DIRECTORY/dudle.mister-muffin.de/
|
Loading…
Reference in a new issue