[Debian-live-changes] r1126 - configs/daniel/config/chroot_localincludes/usr/local/bin

Daniel Baumann daniel at alioth.debian.org
Sun Apr 22 09:32:56 UTC 2007


Author: daniel
Date: 2007-04-22 09:32:56 +0000 (Sun, 22 Apr 2007)
New Revision: 1126

Added:
   configs/daniel/config/chroot_localincludes/usr/local/bin/build
   configs/daniel/config/chroot_localincludes/usr/local/bin/cdebootstraps
   configs/daniel/config/chroot_localincludes/usr/local/bin/dgets
   configs/daniel/config/chroot_localincludes/usr/local/bin/diffs
   configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackage
   configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackages
   configs/daniel/config/chroot_localincludes/usr/local/bin/prepare
Log:


Added: configs/daniel/config/chroot_localincludes/usr/local/bin/build
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/build	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/build	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+prepare
+dpkg-buildpackages
+cd ..
+rm -rf */


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/build
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/cdebootstraps
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/cdebootstraps	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/cdebootstraps	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,449 @@
+#!/bin/sh
+
+# cdebootstraps.sh - Wrapper for cdebootstrap(1)
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ] || [ -z "${1}" ]
+then
+	echo "cdebootstraps.sh - Wrapper for cdebootstrap(1)"
+	echo
+	echo "Usage: `basename ${0}` DISTRIBUTION [SPONSOR]"
+	exit 1
+fi
+
+CODENAME_OLDSTABLE="sarge"
+CODENAME_OLDSTABLE_BACKPORTS="sarge"
+CODENAME_STABLE="etch"
+CODENAME_STABLE_BACKPORTS="etch"
+CODENAME_TESTING="lenny"
+CODENAME_UNSTABLE="sid"
+
+DIRECTORY_CHROOT="/mnt/debian"
+
+MIRROR="http://10.0.0.11/ftp.debian.org/debian/"
+MIRROR_SECURITY="http://10.0.0.11/ftp.debian.org/debian-security/"
+MIRROR_BACKPORTS="http://10.0.0.11/ftp.debian.org/debian-backports/"
+
+DISTRIBUTION="${1}"
+ACTION="${2}"
+USER="user"
+
+if [ -z "${DISTRIBUTION}" ]
+then
+	DISTRIBUTION="unstable"
+fi
+
+case "${DISTRIBUTION}" in
+	oldstable-backports|"${CODENAME_OLDSTABLE}"-backports)
+		DISTRIBUTION="${CODENAME_OLDSTABLE}"
+		;;
+
+	stable-backports|"${CODENAME_STABLE}"-backports)
+		DISTRIBUTION="${CODENAME_STABLE}-backports"
+		;;
+
+	stable-security|"${CODENAME_STABLE}"-security)
+		DISTRIBUTION="${CODENAME_STABLE}-security"
+		;;
+
+	stable|"${CODENAME_STABLE}")
+		DISTRIBUTION="${CODENAME_STABLE}"
+		;;
+
+	testing|"${CODENAME_TESTING}")
+		DISTRIBUTION="${CODENAME_TESTING}"
+		;;
+
+	unstable|"${CODENAME_UNSTBALE}")
+		DISTRIBUTION="${CODENAME_UNSTABLE}"
+		;;
+esac
+
+
+Check_running
+{
+        if [ -f /var/lock/`basename ${0}`_${DISTRIBUTION}.lock ]
+        then
+                echo "E: '"`basename ${0}`"' is already running."
+                exit 1
+        fi
+
+        trap "test -f /var/lock/`basename ${0}_${DISTRIBUTION}`.lock && \
+		rm -f /var/lock/`basename ${0}`_${DISTRIBUTION}.lock; exit 0" 0 2 15
+        touch /var/lock/"`basename ${0}`"_"${DISTRIBUTION}".lock
+}
+
+Check_user()
+{
+        if [ "`id -u`" -ne "0" ]
+        then
+                echo "E: '"`whoami`"' is not root."
+                exit 1
+        fi
+}
+
+Chroot()
+{
+	#sudo sh -c "linux32 chroot ${CHROOT} /usr/bin/env -i HOME=/root PATH=/usr/sbin:/usr/bin:/sbin:/bin TERM=${TERM} DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical ${1}"
+	sudo sh -c "chroot ${CHROOT} /usr/bin/env -i HOME=/root PATH=/usr/sbin:/usr/bin:/sbin:/bin TERM=${TERM} DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical ${1}"
+}
+
+Uninstall()
+{
+	# Unmounting file system
+	fuser -km "${CHROOT}"
+	killall -9 syslogd
+	killall -9 klogd
+
+	umount "${CHROOT}"/sys
+	umount "${CHROOT}"/proc
+	umount "${CHROOT}"/lib/init/rw
+	umount "${CHROOT}"/dev/shm
+	umount "${CHROOT}"/dev/pts
+	umount "${CHROOT}"/dev
+	umount "${CHROOT}"
+
+	# Removing directory
+	rm -rf "${CHROOT}"
+}
+
+Install()
+{
+	# Creating directory
+	mkdir -p "${CHROOT}"
+
+	# Bootstrapping chroot
+	case "${DISTRIBUTION}" in
+		toolchain)
+			cdebootstrap ${CODENAME} ${CHROOT} ${MIRROR_TOOLCHAIN}
+			;;
+
+		*)
+			if [ -z "${ARCH}" ]
+			then
+				cdebootstrap ${CODENAME} ${CHROOT} ${MIRROR}
+			else
+				cdebootstrap --arch ${ARCH} ${CODENAME} ${CHROOT} ${MIRROR}
+			fi
+			;;
+	esac
+}
+
+Configure()
+{
+	# Hack network
+	cp /etc/resolv.conf ${CHROOT}/etc
+	cp /etc/hosts ${CHROOT}/etc
+
+	# Configuring sources.list
+	case "${DISTRIBUTION}" in
+		toolchain)
+			echo "deb ${MIRROR_TOOLCHAIN} ${CODENAME_TOOLCHAIN} main" > ${CHROOT}/etc/apt/sources.list
+			;;
+
+		*)
+			if [ -n "${ARCH}" ]
+			then
+				echo "deb ${MIRROR_AMD64} ${DISTRIBUTION} main contrib non-free" > ${CHROOT}/etc/apt/sources.list
+				echo "deb-src ${MIRROR_AMD64} ${DISTRIBUTION} main contrib non-free" > ${CHROOT}/etc/apt/sources.list
+			else
+				echo "deb ${MIRROR} ${DISTRIBUTION} main contrib non-free" > ${CHROOT}/etc/apt/sources.list
+				echo "deb-src ${MIRROR} ${DISTRIBUTION} main contrib non-free" >> ${CHROOT}/etc/apt/sources.list
+			fi
+			;;
+	esac
+
+	if [ ${CODENAME} != ${CODENAME_UNSTABLE} ] && [ "${DISTRIBUTION}" != "toolchain" ]
+	then
+		echo "deb ${MIRROR_SECURITY} ${DISTRIBUTION}/updates main contrib non-free" >> ${CHROOT}/etc/apt/sources.list
+		echo "deb-src ${MIRROR_SECURITY} ${DISTRIBUTION}/updates main contrib non-free" >> ${CHROOT}/etc/apt/sources.list
+	fi
+
+	Chroot "echo `dpkg --print-architecture` > /etc/debian_chroot"
+
+	# Updating indices
+	Chroot "apt-get --force-yes --yes install -f"
+	Chroot "apt-get --force-yes --yes install"
+	Chroot "apt-get --force-yes --yes update"
+	Chroot "apt-get --force-yes --yes upgrade"
+	Chroot "apt-get --force-yes --yes dist-upgrade"
+	Chroot "apt-get --force-yes --yes install -f"
+	Chroot "apt-get --force-yes --yes install"
+	Chroot "apt-get --force-yes --yes clean"
+}
+
+Custom()
+{
+	# Custom packages
+	Chroot "apt-get --force-yes --yes install vim"
+	Chroot "apt-get --force-yes --yes remove --purge ed nano nvi"
+	Chroot "apt-get --force-yes --yes remove --purge ppp"
+	Chroot "apt-get --force-yes --yes install build-essential debhelper dh-make lintian fakeroot gnupg locales less devscripts wdiff autotools-dev"
+
+	if [ ${DISTRIBUTION} != oldstable ]
+	then
+		Chroot "apt-get --force-yes --yes install dpatch"
+	fi
+
+	if [ ${DISTRIBUTION} = "oldstable" ] || [ ${DISTRIBUTION} = "stable" ] || [ ${DISTRIBUTION} = "backports" ]
+	then
+		Chroot "apt-get install --force-yes --yes adduser"
+	fi
+
+	Chroot "apt-get --force-yes --yes clean"
+
+	# Custom configuration
+	#Chroot 'sed -i -e s/" syntax on/syntax on/ /etc/vim/vimrc'
+
+cat >> ${CHROOT}/etc/profile << "EOF"
+
+alias cp="cp -i"
+alias ln="ln -i"
+alias mv="mv -i"
+alias rm="rm -i"
+
+alias less="less -R"
+alias ls="ls --color"
+
+export GREP_OPTIONS="--color=auto"
+
+#LANGUAGE="en_US"
+#LC_ALL="en_US"
+#LANG="en_US"
+#export LANGUAGE LC_ALL LANG
+
+trap clear 0
+EOF
+
+	echo "Root password"
+	Chroot "passwd"
+	Chroot "adduser ${USER}"
+}
+
+All()
+{
+	#Uninstall
+	Install
+	Configure
+	Custom
+}
+
+Chroot()
+{
+	# Enter chroot
+	if [ "$ARCH" = "i386" ]
+	then
+		linux32 chroot ${CHROOT} /bin/bash --login
+	else
+		chroot ${CHROOT} /bin/bash --login
+	fi
+}
+
+Update()
+{
+	# Updating chroot
+	Chroot "apt-get --force-yes --yes update"
+	Chroot "apt-get --force-yes --yes upgrade"
+	Chroot "apt-get --force-yes --yes dist-upgrade"
+	Chroot "apt-get --force-yes --yes clean"
+}
+
+Save()
+{
+	killall -9 syslogd
+	killall -9 klogd
+
+	# Unmounting file systems
+	umount ${CHROOT}/sys
+	umount ${CHROOT}/proc
+	umount "${CHROOT}"/lib/init/rw
+	umount ${CHROOT}/dev/shm
+	umount ${CHROOT}/dev/pts
+	umount ${CHROOT}/dev
+
+	# Cleaning home directories
+	rm -f ${CHROOT}/root/.bash_history
+	rm -f ${CHROOT}/root/.viminfo
+	rm -f ${CHROOT}/home/${USER}/.bash_history
+	rm -f ${CHROOT}/home/${USER}/.viminfo
+	rm -rf ${CHROOT}/var/tmp/vi.recover
+
+	# Saving chroot
+	rsync -av --delete ${CHROOT}/ ${CHROOT}.snapshot
+
+	# Remounting file systems
+	mount proc-${DISTRIBUTION} ${CHROOT}/proc -t proc
+}
+
+Restore ()
+{
+	killall -9 syslogd
+	killall -9 klogd
+
+	# Unmounting file systems
+	umount ${CHROOT}/sys
+	umount ${CHROOT}/proc
+	umount "${CHROOT}"/lib/init/rw
+	umount ${CHROOT}/dev/shm
+	umount ${CHROOT}/dev/pts
+	umount ${CHROOT}/dev
+
+	# Restoring chroot
+	rsync -av --delete ${CHROOT}.snapshot/ ${CHROOT}
+
+	# Remounting file systems
+	mount proc-${DISTRIBUTION} ${CHROOT}/proc -t proc
+}
+
+Reset ()
+{
+	Restore
+	Update
+	Save
+}
+
+Main()
+{
+	case ${2} in
+		oldstable|${CODENAME_OLDSTABLE})
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/oldstable_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/oldstable"; fi
+			CODENAME="${CODENAME_OLDSTABLE}"
+			DISTRIBUTION="oldstable"
+			;;
+
+		oldstable-backports|${CODENAME_OLDSTABLE}-backports)
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/backports_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/oldstable-backports"; fi
+			CODENAME="${CODENAME_OLDSTABLE}"
+			DISTRIBUTION="oldstable"
+			;;
+
+		stable|${CODENAME_STABLE})
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/stable_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/stable"; fi
+			CODENAME="${CODENAME_STABLE}"
+			DISTRIBUTION="stable"
+			;;
+
+		stable-backports|${CODENAME_STABLE}-backports)
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/backports_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/stable-backports"; fi
+			CODENAME="${CODENAME_STABLE}"
+			DISTRIBUTION="stable"
+			;;
+
+		toolchain)
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/toolchain_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/toolchain"; fi
+			CODENAME="sarge"
+			DISTRIBUTION="toolchain"
+			;;
+
+		testing|${CODENAME_TESTING})
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/testing_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/testing"; fi
+			CODENAME="${CODENAME_TESTING}"
+			DISTRIBUTION="testing"
+			;;
+
+		unstable|${CODENAME_UNSTABLE})
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/unstable_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/unstable"; fi
+			CODENAME="${CODENAME_UNSTABLE}"
+			DISTRIBUTION="unstable"
+			;;
+
+		chroot)
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/chroot_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/chroot"; fi
+			CODENAME="${CODENAME_UNSTABLE}"
+			DISTRIBUTION="unstable"
+			;;
+
+		devel|dev)
+			if [ -n "${ARCH}" ]; then CHROOT="${DIRECTORY_CHROOT}/devel_${ARCH}"; \
+				else CHROOT="${DIRECTORY_CHROOT}/devel"; fi
+			CODENAME="${CODENAME_UNSTABLE}"
+			DISTRIBUTION="unstable"
+			;;
+
+		all)
+			${0} ${1} backports
+			${0} ${1} oldstable
+			${0} ${1} stable
+			${0} ${1} testing
+			${0} ${1} unstable
+			;;
+	esac
+
+	export CHROOT CODENAME DISTRIBUTION
+
+	if [ ! -z ${2} ]
+	then
+		if [ ${1} != "chroot" ]
+		then
+			Check_running
+		fi
+
+		Check_user
+		case "${1}" in
+			uninstall) Uninstall ;;
+			install) Install ;;
+			configure) Configure ;;
+			custom) Custom ;;
+			all) All ;;
+			chroot) Chroot ;;
+			update) Update ;;
+			save) Save ;;
+			restore) Restore ;;
+			reset ) Reset ;;
+		esac
+		exit 0
+	fi
+
+	case ${1} in
+		-h|--help)
+			echo "debootstraps - Meta script for debootstrap(8)"
+			echo
+			echo -e "Usage: \t `basename ${0}` [TARGET] [DISTRIBUTION]"
+			echo -e "Usage: \t `basename ${0}` [OPTION]"
+			echo
+			echo "Targets:"
+			echo -e "\t uninstall: \t\t remove chroot"
+			echo -e "\t install:   \t\t bootstrap chroot"
+			echo -e "\t configure: \t\t configure chroot"
+			echo -e "\t custom:    \t\t install custom packages"
+			echo -e "\t all:       \t\t execute all targets"
+			echo
+                        echo -e "\t chroot:    \t\t enter chroot"
+                        echo -e "\t update:    \t\t update chroot"
+                        echo -e "\t save:      \t\t saves chroot to \$CHROOT.snapshot"
+                        echo -e "\t restore:   \t\t restores chroot from \$CHROOT.snapshot"
+                        echo
+                        echo "Distributions:"
+                        echo -e "\t oldstable: \t\t Debian GNU/Linux oldstable (Woody)"
+                        echo -e "\t stable:    \t\t Debian GNU/Linux stable (Sarge)"
+                        echo -e "\t testing:   \t\t Debian GNU/Linux testing (Etch)"
+                        echo -e "\t unstable:  \t\t Debian GNU/Linux unstable (Sid)"
+                        echo -e "\t all:       \t\t execute all distributions"
+                        echo
+                        echo "Options:"
+                        echo -e "\t -h, --help:    \t display this help and exit"
+                        echo -e "\t -u, --usage:   \t show usage and exit"
+                        echo -e "\t -v, --version: \t output version information and exit"
+                        exit 1
+                        ;;
+
+		*)
+			${0} --help
+			;;
+	esac
+}
+
+Main ${@}


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/cdebootstraps
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/dgets
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/dgets	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/dgets	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+CURDIR="`pwd`"
+SOURCE="`basename ${1} | awk -F_ '{ print $1 }'`"
+
+mkdir NEW
+cd NEW
+dget ${1}
+prepare
+
+cd "${CURDIR}"
+
+mkdir OLD
+cd OLD
+apt-get source --download-only ${SOURCE}
+prepare
+
+cd "${CURDIR}"


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/dgets
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/diffs
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/diffs	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/diffs	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+md5sum OLD/*.tar.gz NEW/*.tar.gz
+echo "pause..."
+read
+diff -Naur OLD/*/ NEW/*/ > DIFF
+vi DIFF


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/diffs
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackage
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackage	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackage	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+dpkg-buildpackage -rfakeroot -k4B2B2B9E


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackage
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackages
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackages	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackages	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+dpkg-buildpackage -rfakeroot -k4B2B2B9E -sa


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/dpkg-buildpackages
___________________________________________________________________
Name: svn:executable
   + *

Added: configs/daniel/config/chroot_localincludes/usr/local/bin/prepare
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/prepare	2007-04-22 09:17:29 UTC (rev 1125)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/prepare	2007-04-22 09:32:56 UTC (rev 1126)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+tar xfz *.orig.tar.gz
+gunzip *.diff.gz
+cd */
+patch -Np1 -i ../*.diff
+rm -f ../*.diff
+chmod 755 debian/rules


Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/prepare
___________________________________________________________________
Name: svn:executable
   + *




More information about the Debian-live-changes mailing list