From: Michael Prokop Date: Fri, 3 Nov 2006 00:20:15 +0000 (+0100) Subject: initial checkin X-Git-Tag: 0.1~25 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=b2febf4be9ecebfea7d91197cd319753638169f9;ds=sidebyside initial checkin --- b2febf4be9ecebfea7d91197cd319753638169f9 diff --git a/chroot-script b/chroot-script new file mode 100644 index 0000000..0e8ea41 --- /dev/null +++ b/chroot-script @@ -0,0 +1,138 @@ +#!/bin/sh +# Filename: /etc/debootstrap/chroot-script +# Purpose: script executed in chroot when installing Debian via grml-debootstrap +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fre Nov 03 01:19:41 CET 2006 [mika] +################################################################################ + +set -e + +. /etc/debootstrap/config || exit 1 + +mount -t proc none /proc + +if [ -n "$RECONFIGURE" ] ; then + for package in $RECONFIGURE ; do + dpkg-reconfigure $package + done +fi + +# set password of user root +passwd + +if ! [ -f /etc/hosts ] ; then + echo "127.0.0.1 localhost $HOSTNAME" > $MNTPOINT/etc/hosts +fi + +if ! [ -f /etc/network/interfaces ] ; then + cat >> /etc/network/interfaces << EOF +iface lo inet loopback +iface eth0 inet dhcp +auto lo +auto eth0 +EOF +fi + +# adjust timezone +if [ -n "$TIMEZONE" ] ; then + ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime +fi + +if ! [ -f /etc/fstab ] ; then +cat >> /etc/fstab << EOF +sysfs /sys sysfs auto 0 0 +proc /proc proc defaults 0 0 +$TARGET / auto defaults,errors=remount-ro 0 1 +# /dev/sda2 none swap sw 0 0 +/dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0 +EOF +fi + +# create default devices +cd /dev && MAKEDEV generic + +# generate initrd +if [ -n "$INITRD" ] ; then + update-initramfs -c -t -k $KERNEL + if [ -f "/boot/initrd.img-$KERNELVER" ] ; then + GRUBINITRD="initrd /boot/initrd.img-$KERNELVER" + LILOINITRD=" initrd=/boot/initrd.img-$KERNELVER" + fi +fi + +# assume the first available kernel as our main kernel +KERNELIMG=$(ls -1 /boot/vmlinuz-* | head -1) +KERNELVER=${KERNELIMG#/boot/vmlinuz-} + +if [ "$BOOTMGR" = 'grub' ] ; then + if ! [ -f /boot/grub/menu.lst ] ; then + # setup grub + mkdir /boot/grub + cat >> /boot/grub/menu.lst << EOF +# Boot automatically after 30 secs. +timeout 30 + +# By default, boot the first entry. +default 0 + +# Fallback to the second entry. +fallback 1 + +title Debian Etch, kernel $KERNELVER (on $ARGET) +root (hd0,0) +kernel $KERNELIMG root=$TARGET ro +$GRUBINITRD + +# For booting Windows +# title Windows +# rootnoverify (hd0,0) +# makeactive +# chainloader +1 +EOF + fi + + # copy stage-files to /boot/grub/ + cp -i /usr/lib/grub/i386-pc/* /boot/grub/ + + # finally install grub + grub-install $BOOT +fi + +if [ "$BOOTMGR" = 'lilo' ] ; then +# /usr/share/doc/lilo/examples/conf.sample +cat > /etc/lilo.conf << EOF +# This allows booting from any partition on disks with more than 1024 cylinders. +lba32 + +# Specifies the boot device +boot=$BOOT + +# Specifies the device that should be mounted as root. +root=$TARGET + +# use Debian on software raid: +# raid-extra-boot=mbr-only + +install=text +# prompt +timeout=1 +map=/boot/map +vga=normal + +image=/boot/vmlinuz-2.6.17-grml + label="$KERNELVER" + #append="...." + read-only + $LILOINITRD +EOF +fi + +# unmount all filesystems in chroot +umount -a + +# finally exit the chroot +exit 0 + +## END OF FILE ################################################################# diff --git a/config b/config new file mode 100644 index 0000000..36ff559 --- /dev/null +++ b/config @@ -0,0 +1,56 @@ +# Filename: /etc/debootstrap/config +# Purpose: configuration file for grml-debootstrap +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fre Nov 03 00:23:46 CET 2006 [mika] +################################################################################ + +################################################################################ +# Important: you definitely have to adjust the following variables! +################################################################################ +# target partition (where should Debian be installed to) +TARGET='' + +# where should the bootmanager installed to? +BOOT='' + +################################################################################ + +# kernel version +KERNEL='linux-image-686' + +# name of debootstrap executable +DEBOOTSTRAP='debootstrap' + +# place of config files for debootstrap +CONFFILES='/etc/debootstrap/' + +# mount point where chroot actions should take place +MNTPOINT='/mnt/test' + +# mirror (download packages from) +MIRROR='ftp://ftp.tugraz.at/mirror/debian' + +# release (which Debian version should be installed) +RELEASE='etch' + +# hostname of new system +HOSTNAME='grml' + +# executable which should be run on $TARGET +MKFS='mkfs.ext3' + +# which packages do you want do dpkg-reconfigure? +RECONFIGURE='locales console-data' + +# use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime +TIMEZONE='Europe/Vienna' + +# generate initrd? +INITRD='yes' + +# which bootmanager do you want to use? [grub|lilo] +BOOTMGR='grub' + +## END OF FILE ################################################################# diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..da3090e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +grml-debootstrap (0.1) unstable; urgency=low + + * Initial release. + + -- Michael Prokop Fri, 3 Nov 2006 01:10:52 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5f67376 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: grml-debootstrap +Section: grml +Priority: optional +Maintainer: Michael Prokop +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: grml-debootstrap +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: wrapper around debootstrap for installing plain Debian via grml + This package provides a wrapper suite around deboostrap and + cdebootstrap for installing a plain Debian system via grml. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8ce9b46 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +This package was debianized by Michael Prokop on +Fri, 3 Nov 2006 01:10:52 +0100. + +It was downloaded from http://grml.org/repos/ + +Upstream Author: Michael Prokop + +Copyright: (c) 2006+ Michael Prokop + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2006, Michael Prokop and +is licensed under the GPL, see above. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e69de29 diff --git a/debian/grml-debootstrap.8 b/debian/grml-debootstrap.8 new file mode 100644 index 0000000..2b54452 --- /dev/null +++ b/debian/grml-debootstrap.8 @@ -0,0 +1,31 @@ +.TH GRML-DEBOOTSTRAP 8 +.SH NAME +grml-debootstrap \- program to do something +.SH SYNOPSIS +.B grml-debootstrap +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B grml-debootstrap +command. +.PP +\fBgrml-debootstrap\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR debootstrap (8), +.BR cdebootstrap (1). +.SH AUTHOR +grml-debootstrap was written by Michael Prokop . +.PP +This manual page was written by Michael Prokop , +for the Debian project (but may be used by others). diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..eb5f23f --- /dev/null +++ b/debian/rules @@ -0,0 +1,59 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp + +build-stamp: + dh_testdir + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs etc/debootstrap usr/sbin + + # Add here commands to install the package into debian/grml-debootstrap. + install -m 644 config debian/grml-debootstrap/etc/debootstrap/ + install -m 644 packages debian/grml-debootstrap/etc/debootstrap/ + install -m 755 chroot-script debian/grml-debootstrap/etc/debootstrap/ + install -m 755 grml-debootstrap debian/grml-debootstrap/usr/sbin/ + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_installman debian/grml-debootstrap.8 + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/grml-debootstrap b/grml-debootstrap new file mode 100644 index 0000000..a22a021 --- /dev/null +++ b/grml-debootstrap @@ -0,0 +1,71 @@ +#!/bin/sh +# Filename: grml-bootstrap +# Purpose: wrapper around debootstrap for installing plain Debian via grml +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fre Nov 03 00:54:39 CET 2006 [mika] +################################################################################ +# http://www.debian.org/releases/stable/i386/apcs04.html.en + +set -eu # exit on any error + +. /etc/grml/lsb-functions +. /etc/grml/script-functions + +check4progs debootstrap || exit 1 + +if [ -r /etc/debootstrap/config ] ; then + . /etc/debootstrap/config +else + echo "/etc/debootstrap/config could not be read, exiting." + exit 1 +fi + +if [ -z "$TARGET" ] ; then + eerror "Please adjust /etc/debootstrap/config before running ${0}" ; eend 1 + exit 1 +fi + +# make an ext3 filesystem on /dev/sda1 +einfo "Running $MKFS on $TARGET" +$MKFS $TARGET +eend $? + +# now mount the new partition +einfo "Mounting $TARGET to $MNTPOINT" +mount -o rw,suid,dev $TARGET $MNTPOINT +eend $? + +# get main packages from a debian-mirror +einfo "Running $DEBOOTSTRAP for release $RELEASE using mirror $MIRROR" +$DEBOOTSTRAP $RELEASE $MNTPOINT $MIRROR +eend $? + +einfo "Preparing chroot system" + cp $CONFFILES/chroot-script $MNTPOINT/bin/chroot-script + chmod 755 $MNTPOINT/bin/chroot-script + mkdir $MNTPOINT/etc/deboostrap/ + + # make sure we have our config file for later use via chroot-script + cp /etc/debootstrap/config $MNTPOINT/etc/debootstrap/ + + # copy any existing existing files to chroot + [ -d /etc/debootstrap/boot ] && cp -a /etc/debootstrap/boot/* $MNTPOINT/boot/ + [ -d /etc/debootstrap/etc ] && cp -a /etc/debootstrap/etc/* $MNTPOINT/etc/ + [ -d /etc/debootstrap/share ] && cp -a /etc/debootstrap/share/* $MNTPOINT/share/ + [ -d /etc/debootstrap/usr ] && cp -a /etc/debootstrap/usr/* $MNTPOINT/usr/ + [ -d /etc/debootstrap/var ] && cp -a /etc/debootstrap/var/* $MNTPOINT/var/ +eend $? + +einfo "Executing chroot-script now" +chroot $MNTPOINT /bin/chroot-script +eend $? + +einfo "Unmount $MNTPOINT" +umount $MNTPOINT +eend $? + +einfo "Finished execution of $0 - enjoy your Debian system." ; eend 0 + +## END OF FILE ################################################################# diff --git a/packages b/packages new file mode 100644 index 0000000..921da3a --- /dev/null +++ b/packages @@ -0,0 +1,3 @@ +locales console-data +vim most zsh screen less initrd-tools file grub usbutils pciutils bzip2 sysfsutils dhcp3-client resolvconf strace lsof w3m +linux-headers-2.6-686 linux-image-2.6-686