From 09b0620373b84ff9ae38dcb57f8904825af38f3a Mon Sep 17 00:00:00 2001 From: Daniel Francis Date: Thu, 24 Jan 2013 22:29:22 +0000 Subject: Build Sugar and allow to Chroot Signed-off-by: Daniel Francis --- diff --git a/env.sh b/env.sh index ffe8969..af9efa1 100755 --- a/env.sh +++ b/env.sh @@ -40,6 +40,7 @@ copy_files () { cp sources.list install/etc/apt/ cp sugar-env-setup.sh install/usr/bin/ cp sugar-build-clone.sh install/usr/bin/ + cp install/etc/bash.bashrc install/root/.bashrc echo "[OK]" } @@ -52,9 +53,11 @@ installenv () { debootstrap --variant=buildd quantal ./install http://archive.ubuntu.com/ubuntu/ copy_files - chroot install sugar-env-setup.sh + ./sugar-chroot install sugar-env-setup.sh +} - exit +chrootshell () { + ./sugar-chroot install su sugar } # Help message @@ -63,7 +66,6 @@ usage () { echo $0 install - Install the environment and build Sugar echo $0 shell - A virtual shell to run Sugar echo $0 help - Show this help message and exit - exit } #Check for arguments diff --git a/sugar-build-clone.sh b/sugar-build-clone.sh index d10c94c..6e5a15c 100755 --- a/sugar-build-clone.sh +++ b/sugar-build-clone.sh @@ -18,6 +18,12 @@ # MA 02110-1301, USA. cd + +echo "Cloning Sugar Build" git clone git://git.sugarlabs.org/sugar-build/sugar-build.git +echo "[OK]" cd sugar-build + +echo "Running Sugar Build" +# Install required packages make build diff --git a/sugar-chroot b/sugar-chroot new file mode 100755 index 0000000..817d8d4 --- /dev/null +++ b/sugar-chroot @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (C) 2013 Daniel Francis +# +# Based in qchroot +# by Alan M Bruce (qole) with help from Benson Mitchell and Thomas Perl +# +# This program 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 3 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +CHROOT=$1 + +# Devices +mount --bind /dev "$CHROOT/dev" +# Processes +mount --bind /proc "$CHROOT/proc" + +#Gentoo wiki says this will make X work +mount --bind /dev/pts "$CHROOT/dev/pts" +mount --bind /tmp "$CHROOT/tmp" + +#Open e-mail attachments, etc +mount --bind /var/tmp "$CHROOT/var/tmp" + +#ArchLinux suggestions +mount --bind /dev/shm "$CHROOT/dev/shm" +mount --bind /sys "$CHROOT/sys" + +#Make DBus work +mount --bind /var/run/dbus "$CHROOT/var/run/dbus" +mount --bind /var/lib/dbus "$CHROOT/var/lib/dbus" + +#Make pulseaudio work +mount -o bind /var/run/pulse "$CHROOT/var/run/pulse" + +xhost + > /dev/null + +# Now chroot +chroot $@ + +# Unmount all partitions +umount "$CHROOT/dev" + +umount "$CHROOT/proc" + +umount "$CHROOT/dev/pts" +umount "$CHROOT/tmp" + +umount "$CHROOT/var/tmp" + +umount "$CHROOT/dev/shm" +umount "$CHROOT/sys" + +umount "$CHROOT/var/run/dbus" +umount "$CHROOT/var/lib/dbus" + +umount "$CHROOT/var/run/pulse" + +#All done, reset. +exit 0 diff --git a/sugar-env-setup.sh b/sugar-env-setup.sh index ec028cb..f08170b 100755 --- a/sugar-env-setup.sh +++ b/sugar-env-setup.sh @@ -19,7 +19,7 @@ configure_apt () { echo "Configuring APT" - apt-get update >> /dev/null + apt-get update echo "[OK]" } @@ -27,6 +27,9 @@ install_packages () { echo "Installing packages required to run Sugar-build" apt-get -y install ssh git python sudo time locales dialog python-apt echo "[OK]" + echo "Generating locales" + locale-gen $LANG + echo "[OK]" } create_user () { @@ -34,7 +37,7 @@ create_user () { mkdir /home/sugar useradd -g sudo -d /home/sugar -s /bin/bash sugar chown sugar /home/sugar - passwd -d sugar >> /dev/null + passwd sugar echo "[OK]" } -- cgit v0.9.1