From: Andres Salomon Date: Tue, 19 Aug 2008 20:46:17 +0000 (-0400) Subject: add initchroot script X-Git-Tag: v0.1~18 X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d209b5da08929973f4f3f40155c28446affd580;hp=0308aefb96a01181b7c161f59377328d2a795406;p=xodist add initchroot script Signed-off-by: Andres Salomon --- 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