#!/bin/bash ## # Project: Ubuntu Builder - A handy tool to build your own Ubuntu based distribution # Author: Francesco Muriana # Copyright: 2010-2012 Francesco Muriana # License: GPL-2+ # 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 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. # # On Debian GNU/Linux systems, the full text of the GNU General Public License # can be found in the file /usr/share/common-licenses/GPL-2. ## function title { echo -en "\033]2;$@\007" } title Installing Apps WORKPATH=/home/ubuntu-builder FSPATH=$WORKPATH/FileSystem (echo echo STARTING PRESETS INSTALLATION echo cd $WORKPATH/configs wget www.google.com > /dev/null if [ ! "$?" -eq 0 ]; then zenity --warning --text "You are not connected to the Internet, the script will close." exit fi rm $WORKPATH/configs/index.html cd cp $WORKPATH/configs/PACKAGES $FSPATH/tmp/ cp /etc/hosts $FSPATH/etc/ sudo mount --bind /dev $FSPATH/dev mount --bind /var/run/dbus $FSPATH/var/lib/dbus mount --bind /var/run/dbus $FSPATH/var/run/dbus touch $FSPATH/tmp/script.bash cat > $FSPATH/tmp/script.bash << "EOF" #################### CHROOT ENVIRONMENT #################### #!/bin/bash export HOME=/root export LC_ALL=C mount none -t proc /proc mount none -t sysfs /sys mount none -t devpts /dev/pts apt-get update -q read PACKAGES < /tmp/PACKAGES if [ "$PACKAGES" = "mate-core mate-utils xserver-xorg" ]; then echo "deb http://packages.mate-desktop.org/repo/ubuntu `lsb_release -cs` main" | tee -a $FSPATH/etc/apt/sources.list apt-get update apt-get install -y --force-yes mate-archive-keyring fi apt-get install -y --force-yes $PACKAGES --no-install-recommends if [ -e /usr/sbin/gdm ]; then apt-get purge -y gdm elif [ -e /usr/sbin/lightdm ]; then apt-get purge -y lightdm elif [ -e /usr/sbin/kdm ]; then apt-get purge -y kdm elif [ -e /usr/sbin/xdm ]; then apt-get purge -y xdm fi update-initramfs -u -k all EOF ######################### on EXIT ######################### echo "apt-get clean rm -rf /tmp/* rm -rf /etc/hosts umount -lf /proc umount -lf /sys umount -lf /dev/pts umount -lf /var/lib/dbus umount -lf /var/run/dbus" >> $FSPATH/tmp/script.bash chroot $FSPATH sh /tmp/script.bash umount -l $FSPATH/dev zenity --info --text="Installation completed." ) | tee -a $WORKPATH/ubuntu-builder.log