From 4d209b5da08929973f4f3f40155c28446affd580 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 19 Aug 2008 16:46:17 -0400 Subject: [PATCH] add initchroot script Signed-off-by: Andres Salomon --- initchroot.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ package_list | 34 ++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100755 initchroot.sh create mode 100644 package_list diff --git a/initchroot.sh b/initchroot.sh new file mode 100755 index 0000000..9d5f4a8 --- /dev/null +++ b/initchroot.sh @@ -0,0 +1,89 @@ +#!/bin/sh -e +# +# Copyright © 2008 Andres Salomon +# +# This file 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 program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DIST=lenny +DEFUSER=olpc + +. functions.sh + +usage() +{ + echo "" 1>&2 + echo "Usage: $0 " 1>&2 + echo "" 1>&2 + exit 1 +} + +if [ "$#" != "1" ]; then + usage +fi + +ROOT_DIR=$1 + +if [ -d "${ROOT_DIR}" ]; then + echo "" 1>&2 + echo "*** ${ROOT_DIR} already exists!" 1>&2 + usage +fi + +check_for_cmds debootstrap || exit 1 + +# create chroot +debootstrap --arch i386 lenny ${ROOT_DIR} http://http.us.debian.org/debian +mount -t proc proc ${ROOT_DIR}/proc +mount -t devpts devpts ${ROOT_DIR}/dev/pts + +# set up apt +export DEBIAN_FRONTEND=noninteractive +export DEBCONF_PRIORITY=critical +cat >${ROOT_DIR}/etc/apt/apt.conf<${ROOT_DIR}/etc/apt/sources.list<${ROOT_DIR}/etc/locale.gen +(chroot ${ROOT_DIR} aptitude install -y locales) +k=$(wget -O- http://queued.mit.edu/~dilinger/builds-master/ | sed -ne 's/.*href="\(.\+\)_i386.deb".*/\1_i386.deb/p' | tail -n1) +wget -O ${ROOT_DIR}/${k} http://queued.mit.edu/~dilinger/builds-master/${k} +(chroot ${ROOT_DIR} dpkg -i /${k}) +rm -f ${ROOT_DIR}/${k} + +# install packages +(chroot ${ROOT_DIR} aptitude install -y `cat package_list`) + +# add default user +(chroot ${ROOT_DIR} useradd -s /bin/bash ${DEFUSER}) +(chroot ${ROOT_DIR} passwd -d ${DEFUSER}) +(chroot ${ROOT_DIR} adduser ${DEFUSER} cdrom) +(chroot ${ROOT_DIR} adduser ${DEFUSER} audio) +(chroot ${ROOT_DIR} adduser ${DEFUSER} video) +(chroot ${ROOT_DIR} adduser ${DEFUSER} plugdev) +(chroot ${ROOT_DIR} adduser ${DEFUSER} netdev) +(chroot ${ROOT_DIR} adduser ${DEFUSER} powerdev) +echo "${DEFUSER} ALL=(ALL) ALL" >> ${ROOT_DIR}/etc/sudoers + +# done, clean up +(chroot ${ROOT_DIR} aptitude clean) +umount ${ROOT_DIR}/proc +umount ${ROOT_DIR}/dev/pts diff --git a/package_list b/package_list new file mode 100644 index 0000000..fc456c3 --- /dev/null +++ b/package_list @@ -0,0 +1,34 @@ +libertas-firmware +xserver-xorg-core +xserver-xorg-input-kbd +xserver-xorg-input-mouse +xserver-xorg-video-geode +xfonts-100dpi +openssh-client +openntpd +diff +bzip2 +aspell-en +info +manpages-dev +rsync +sudo +gdm +gnome-core +gnome-backgrounds +gnome-power-manager +gnome-media +gnome-mount +gnome-system-tools +gnome-themes +gnome-utils +network-manager-gnome +claws-mail +epiphany-browser +iceweasel +links2 +pidgin +evince +xpdf +totem +vlc -- 2.39.2