1.1 --- a/README.txt Mon Mar 29 00:10:33 2010 +0200
1.2 +++ b/README.txt Thu Apr 15 00:44:21 2010 +0200
1.3 @@ -20,8 +20,8 @@
1.4 docs/COPYING.txt and docs/gpl-3.0.txt for more information.
1.5
1.6 Thanks to Piotr Roszatycki, the maintainer of fakechroot, for helpfully fixing
1.7 -system call coverage in that utility in order to support cross-distribution
1.8 -bootstrapping.
1.9 +system call coverage in that utility in order to attempt to support
1.10 +cross-distribution bootstrapping.
1.11
1.12 Dependencies
1.13 ------------
1.14 @@ -38,9 +38,13 @@
1.15 * Adopted lsb-release environment variables instead of new ones like
1.16 DISTNAME, exposing derivatives of these variables by default.
1.17 * Added explicit keyring package installation.
1.18 - * Added scripts for configuring and entering the chroot.
1.19 + * Added -do scripts for configuring and entering the chroot.
1.20 * Added support for UML instance construction from distribution
1.21 installations.
1.22 + * Removed specific apt- and dpkg-related scripts, replacing them with the
1.23 + general -do scripts.
1.24 + * Added --root options to certain scripts in order to support normal chroot
1.25 + installations.
1.26
1.27 Configuration
1.28 -------------
1.29 @@ -87,10 +91,6 @@
1.30
1.31 user-setup
1.32
1.33 -Or with defaults in the current directory:
1.34 -
1.35 -./user-setup
1.36 -
1.37 It is possible to override the "template" for the system by specifying a
1.38 "mirror" location. This is useful if you have the CD or DVD image for the
1.39 distribution already mounted in the filesystem. For example:
1.40 @@ -124,35 +124,23 @@
1.41
1.42 user-path /etc/apt/sources.list
1.43
1.44 -Or with defaults in the current directory:
1.45 -
1.46 -./user-path /etc/apt/sources.list
1.47 -
1.48 And you can edit the file directly with a text editor (such as vi) as follows:
1.49
1.50 vi `user-path /etc/apt/sources.list`
1.51
1.52 -Or with defaults in the current directory:
1.53 -
1.54 -vi `./user-path /etc/apt/sources.list`
1.55 -
1.56 Installing Packages
1.57 -------------------
1.58
1.59 -To install packages from other repositories, invoke the user-apt-get script
1.60 -with the options expected by the regular apt-get program. For example:
1.61 -
1.62 -user-apt-get --help
1.63 -user-apt-get update
1.64 +To install packages from other repositories, invoke the user-do script and
1.65 +specify the apt-get program together with options expected by that program.
1.66 +For example:
1.67
1.68 -It may be necessary to install the gnupg package to enable package signature
1.69 -verification:
1.70 +user-do apt-get --help
1.71 +user-do apt-get update
1.72
1.73 -user-apt-get install gnupg
1.74 +Packages can then be installed. For example:
1.75
1.76 -Then, other packages can be installed. For example:
1.77 -
1.78 -user-apt-get install python-cmdsyntax
1.79 +user-do apt-get install python-cmdsyntax
1.80
1.81 Provided that the specified packages are known and their dependencies can be
1.82 met, they will be installed into the system.
1.83 @@ -160,13 +148,14 @@
1.84 Installing Single Packages
1.85 --------------------------
1.86
1.87 -To install individual package files, invoke the user-dpkg-i script with the
1.88 -name of the package file. For example:
1.89 +To install individual package files, first copy them into the package manager
1.90 +directory hierarchy. For example:
1.91
1.92 -user-dpkg-i /home/me/downloads/python-cmdsyntax_0.91-0ubuntu2_all.deb
1.93 +cp python-cmdsyntax_0.91-0ubuntu2_all.deb `user-path /tmp`
1.94
1.95 -This script will copy the file into the personal package management
1.96 -environment and run dpkg with the -i (install) option.
1.97 +The invoke the dpkg program through the user-do script as follows:
1.98 +
1.99 +user-do dpkg -i /tmp/python-cmdsyntax_0.91-0ubuntu2_all.deb
1.100
1.101 Using Packages
1.102 --------------
1.103 @@ -197,9 +186,9 @@
1.104 More complicated extension modules may require further adjustments to the
1.105 LD_LIBRARY_PATH and PYTHONPATH variables:
1.106
1.107 -export LD_LIBRARY_PATH=`./user-path /usr/lib`
1.108 -export PYTHONPATH=`./user-path /usr/lib/python2.5/site-packages/`
1.109 -export PYTHONPATH=${PYTHONPATH}:`./user-path /var/lib/python-support/python2.5`
1.110 +export LD_LIBRARY_PATH=`user-path /usr/lib`
1.111 +export PYTHONPATH=`user-path /usr/lib/python2.5/site-packages/`
1.112 +export PYTHONPATH=${PYTHONPATH}:`user-path /var/lib/python-support/python2.5`
1.113
1.114 Entering the Package Manager
1.115 ----------------------------
1.116 @@ -207,7 +196,7 @@
1.117 It is also possible to administer the package manager from within the
1.118 installation:
1.119
1.120 -user-enter
1.121 +user-do
1.122
1.123 This should provide a "root" prompt which can then be used to issue commands
1.124 within the package manager environment. For example:
1.125 @@ -222,12 +211,12 @@
1.126 the User Mode Linux (UML) software.
1.127
1.128 To convert a package manager installation into a UML instance, start with the
1.129 -uml-postsetup script which changes the installation's configuration in a
1.130 -number of areas:
1.131 +user-to-uml script which changes the installation's configuration in a number
1.132 +of areas:
1.133
1.134 -uml-postsetup
1.135 +user-to-uml
1.136
1.137 -Then, as a privileged user, run the user-setupdev script to initialise some
1.138 +Then, as a privileged user, run the uml-setupdev script to initialise some
1.139 UML-specific device files:
1.140
1.141 sudo uml-setupdev
1.142 @@ -249,6 +238,6 @@
1.143 Entering or Starting UML Instances
1.144 ----------------------------------
1.145
1.146 -To enter a UML instance, use the uml-enter script:
1.147 +To enter a UML instance, use the uml-do script:
1.148
1.149 -uml-enter
1.150 +uml-do
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/uml-do Thu Apr 15 00:44:21 2010 +0200
2.3 @@ -0,0 +1,27 @@
2.4 +#!/bin/bash
2.5 +# Usage: uml-enter <memory> [ <command and options> ]
2.6 +
2.7 +# Configuration:
2.8 +if [ -e userinstall-defaults-uml ]; then
2.9 + source userinstall-defaults-uml
2.10 +elif [ -e /etc/default/userinstall-uml ]; then
2.11 + source /etc/default/userinstall-uml
2.12 +else
2.13 + echo "No defaults found for userinstall (UML)."
2.14 + exit 1
2.15 +fi
2.16 +
2.17 +if [[ ! $1 ]]; then
2.18 + echo "$0 <memory>"
2.19 + exit 1
2.20 +fi
2.21 +
2.22 +export IMAGE=$UMLROOT/rootfs
2.23 +export SWAPIMAGE=$UMLROOT/swap
2.24 +export UML_MEMORY=$1
2.25 +export THIS_DIR=`dirname $0`
2.26 +
2.27 +# Now we start the virtual machine...
2.28 +
2.29 +shift 1
2.30 +$THIS_DIR/linux ubd0=$IMAGE ubd1=$SWAPIMAGE mem=$UML_MEMORY $*
3.1 --- a/uml-enter Mon Mar 29 00:10:33 2010 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,18 +0,0 @@
3.4 -#!/bin/bash
3.5 -# Usage: uml-enter <memory>
3.6 -
3.7 -# Configuration:
3.8 -if [ -e userinstall-defaults-uml ]; then
3.9 - source userinstall-defaults-uml
3.10 -elif [ -e /etc/default/userinstall-uml ]; then
3.11 - source /etc/default/userinstall-uml
3.12 -else
3.13 - echo "No defaults found for userinstall (UML)."
3.14 - exit 1
3.15 -fi
3.16 -
3.17 -export IMAGE=$UMLROOT/rootfs
3.18 -export SWAPIMAGE=$UMLROOT/swap
3.19 -
3.20 -# Now we start the virtual machine...
3.21 -`dirname $0`/linux ubd0=$IMAGE ubd1=$SWAPIMAGE mem=$1
4.1 --- a/uml-postsetup Mon Mar 29 00:10:33 2010 +0200
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,45 +0,0 @@
4.4 -#!/bin/bash
4.5 -# Usage: uml-postsetup
4.6 -
4.7 -# Configuration:
4.8 -if [ -e userinstall-defaults ]; then
4.9 - source userinstall-defaults
4.10 -elif [ -e /etc/default/userinstall ]; then
4.11 - source /etc/default/userinstall
4.12 -else
4.13 - echo "No defaults found for userinstall."
4.14 - exit 1
4.15 -fi
4.16 -
4.17 -echo "Removing any linked /dev entry..."
4.18 -if [ -h "$PACKAGEROOT/dev" ]; then
4.19 - rm $PACKAGEROOT/dev
4.20 - mkdir $PACKAGEROOT/dev
4.21 -fi
4.22 -
4.23 -cp /dev/MAKEDEV $PACKAGEROOT/dev
4.24 -
4.25 -echo "Removing any linked /proc entry..."
4.26 -if [ -h "$PACKAGEROOT/proc" ]; then
4.27 - rm $PACKAGEROOT/proc
4.28 - mkdir $PACKAGEROOT/proc
4.29 -fi
4.30 -
4.31 -echo "Using a special fstab..."
4.32 -if [ -e "$PACKAGEROOT/etc/fstab" ]; then
4.33 - mv $PACKAGEROOT/etc/fstab $PACKAGEROOT/etc/fstab.orig
4.34 -fi
4.35 -cp `dirname $0`/UML/fstab $PACKAGEROOT/etc/fstab
4.36 -
4.37 -# Tweak the inittab to only use tty0 and add it to securetty.
4.38 -echo "Reconfiguring the console settings..."
4.39 -if [ ! -e "$PACKAGEROOT/etc/inittab.save" ]; then
4.40 - cp $PACKAGEROOT/etc/inittab $PACKAGEROOT/etc/inittab.save
4.41 - grep -v "getty" $PACKAGEROOT/etc/inittab.save > $PACKAGEROOT/etc/inittab
4.42 - echo "# We launch just one console for UML:" >> $PACKAGEROOT/etc/inittab
4.43 - echo "c0:1235:respawn:/sbin/getty 38400 tty0 linux" >> $PACKAGEROOT/etc/inittab
4.44 -
4.45 - echo "# UML modification: use tty0 or vc/0" >> $PACKAGEROOT/etc/securetty
4.46 - echo "tty0" >> $PACKAGEROOT/etc/securetty
4.47 - echo "vc/0" >> $PACKAGEROOT/etc/securetty
4.48 -fi
5.1 --- a/user-apt-get Mon Mar 29 00:10:33 2010 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,14 +0,0 @@
5.4 -#!/bin/bash
5.5 -# Usage: user-apt-get [ <apt-get-options> ]
5.6 -
5.7 -# Configuration:
5.8 -if [ -e userinstall-defaults ]; then
5.9 - source userinstall-defaults
5.10 -elif [ -e /etc/default/userinstall ]; then
5.11 - source /etc/default/userinstall
5.12 -else
5.13 - echo "No defaults found for userinstall."
5.14 - exit 1
5.15 -fi
5.16 -
5.17 -fakeroot fakechroot $FAKECHROOT_OPTIONS chroot $PACKAGEROOT apt-get $*
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/user-do Thu Apr 15 00:44:21 2010 +0200
6.3 @@ -0,0 +1,19 @@
6.4 +#!/bin/bash
6.5 +# Usage: user-enter [ --root ] [ <command and options> ]
6.6 +
6.7 +# Configuration:
6.8 +if [ -e userinstall-defaults ]; then
6.9 + source userinstall-defaults
6.10 +elif [ -e /etc/default/userinstall ]; then
6.11 + source /etc/default/userinstall
6.12 +else
6.13 + echo "No defaults found for userinstall."
6.14 + exit 1
6.15 +fi
6.16 +
6.17 +if [[ $1 == '--root' ]]; then
6.18 + shift 1
6.19 + chroot $PACKAGEROOT $*
6.20 +else
6.21 + fakeroot fakechroot $FAKECHROOT_OPTIONS chroot $PACKAGEROOT $*
6.22 +fi
7.1 --- a/user-dpkg-i Mon Mar 29 00:10:33 2010 +0200
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,38 +0,0 @@
7.4 -#!/bin/bash
7.5 -# Usage: user-dpkg-i <package-file>
7.6 -
7.7 -# Configuration:
7.8 -if [ -e userinstall-defaults ]; then
7.9 - source userinstall-defaults
7.10 -elif [ -e /etc/default/userinstall ]; then
7.11 - source /etc/default/userinstall
7.12 -else
7.13 - echo "No defaults found for userinstall."
7.14 - exit 1
7.15 -fi
7.16 -
7.17 -if [[ $1 == "--help" ]]; then
7.18 - echo "Usage: user-dpkg-i <package-file>"
7.19 - echo
7.20 - echo "Examples:"
7.21 - echo
7.22 - echo "user-dpkg-i downloads/python-cmdsyntax_0.91-0ubuntu2_all.deb"
7.23 - exit 1
7.24 -fi
7.25 -
7.26 -export PERSONAL=$PACKAGEROOT/personal
7.27 -
7.28 -if [ ! -e $PERSONAL ]; then
7.29 - mkdir $PERSONAL
7.30 -fi
7.31 -
7.32 -if [ ! $1 ]; then
7.33 - echo "Please specify a package file."
7.34 - exit 1
7.35 -fi
7.36 -
7.37 -export PACKAGEFILE=`basename $1`
7.38 -export PPACKAGEFILE=$PERSONAL/$PACKAGEFILE
7.39 -
7.40 -cp $1 $PPACKAGEFILE
7.41 -fakeroot fakechroot $FAKECHROOT_OPTIONS chroot $PACKAGEROOT dpkg -i $PPACKAGEFILE
8.1 --- a/user-enter Mon Mar 29 00:10:33 2010 +0200
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,18 +0,0 @@
8.4 -#!/bin/bash
8.5 -# Usage: user-enter
8.6 -
8.7 -# Configuration:
8.8 -if [ -e userinstall-defaults ]; then
8.9 - source userinstall-defaults
8.10 -elif [ -e /etc/default/userinstall ]; then
8.11 - source /etc/default/userinstall
8.12 -else
8.13 - echo "No defaults found for userinstall."
8.14 - exit 1
8.15 -fi
8.16 -
8.17 -if [[ $1 == '--root' ]]; then
8.18 - chroot $PACKAGEROOT
8.19 -else
8.20 - fakeroot fakechroot $FAKECHROOT_OPTIONS chroot $PACKAGEROOT
8.21 -fi
9.1 --- a/user-postsetup Mon Mar 29 00:10:33 2010 +0200
9.2 +++ b/user-postsetup Thu Apr 15 00:44:21 2010 +0200
9.3 @@ -1,5 +1,5 @@
9.4 #!/bin/bash
9.5 -# Usage: user-postsetup [ <country> ]
9.6 +# Usage: user-postsetup [ --root ] [ <country> ]
9.7
9.8 # Configuration:
9.9 if [ -e userinstall-defaults ]; then
9.10 @@ -11,6 +11,15 @@
9.11 exit 1
9.12 fi
9.13
9.14 +if [[ $1 && $1 == '--root' ]]; then
9.15 + export AS_ROOT=' --root'
9.16 + export COUNTRY=$2
9.17 +else
9.18 + export COUNTRY=$1
9.19 +fi
9.20 +
9.21 +export THIS_DIR=`dirname $0`
9.22 +
9.23 echo "Copying host DNS configuration..."
9.24 cp /etc/resolv.conf $PACKAGEROOT/etc/
9.25
9.26 @@ -28,5 +37,25 @@
9.27 cp $USERINSTALL_CODENAME/sources.list $PACKAGEROOT/etc/apt/
9.28 else
9.29 echo "Attempting to generate a repository definition for $USERINSTALL_CODENAME."
9.30 - `dirname $0`/user-makesources $PACKAGEROOT/etc/apt/sources.list $1
9.31 + $THIS_DIR/user-makesources $PACKAGEROOT/etc/apt/sources.list $COUNTRY
9.32 +fi
9.33 +
9.34 +if [[ $AS_ROOT ]]; then
9.35 + echo "Mounting filesystems..."
9.36 + $THIS_DIR/user-do$AS_ROOT mount -t proc proc /proc
9.37 fi
9.38 +
9.39 +echo "Updating package details and upgrading..."
9.40 +$THIS_DIR/user-do$AS_ROOT apt-get update
9.41 +$THIS_DIR/user-do$AS_ROOT apt-get upgrade
9.42 +
9.43 +if [[ $AS_ROOT ]]; then
9.44 + echo "Configuring a root installation..."
9.45 + $THIS_DIR/user-do$AS_ROOT apt-get install locales console-data
9.46 + $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure locales
9.47 + $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure tzdata
9.48 + $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure console-data
9.49 +
9.50 + echo "Unmounting filesystems..."
9.51 + $THIS_DIR/user-do$AS_ROOT umount /proc
9.52 +fi
10.1 --- a/user-setup Mon Mar 29 00:10:33 2010 +0200
10.2 +++ b/user-setup Thu Apr 15 00:44:21 2010 +0200
10.3 @@ -12,22 +12,20 @@
10.4 fi
10.5
10.6 if [[ $1 == "--help" ]]; then
10.7 - echo "Usage: user-setup [ <mirror> ]"
10.8 + echo "Usage: user-setup [ --root ] [ <mirror> ]"
10.9 echo
10.10 echo "Examples:"
10.11 echo
10.12 echo "user-setup"
10.13 echo "user-setup file:///tmp/$USERINSTALL_CODENAME/"
10.14 echo "user-setup http://ftp.xx.debian.org/debian/"
10.15 + echo "user-setup --root http://ftp.xx.debian.org/debian/"
10.16 exit 1
10.17 fi
10.18
10.19 if [[ $1 && $1 == '--root' ]]; then
10.20 - export AS_ROOT=true
10.21 + export AS_ROOT=' --root'
10.22 export MIRROR=$2
10.23 -elif [[ $2 && $2 == '--root' ]]; then
10.24 - export AS_ROOT=true
10.25 - export MIRROR=$1
10.26 else
10.27 export MIRROR=$1
10.28 fi
10.29 @@ -42,8 +40,4 @@
10.30 echo
10.31 echo "Don't forget to run the following before installing packages:"
10.32 echo
10.33 -echo "user-apt-get update"
10.34 -
10.35 -if [[ $AS_ROOT ]]; then
10.36 - echo "dpkg-reconfigure locales"
10.37 -fi
10.38 +echo "user-postsetup$AS_ROOT [ <country> ]"
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/user-to-uml Thu Apr 15 00:44:21 2010 +0200
11.3 @@ -0,0 +1,45 @@
11.4 +#!/bin/bash
11.5 +# Usage: user-to-uml
11.6 +
11.7 +# Configuration:
11.8 +if [ -e userinstall-defaults ]; then
11.9 + source userinstall-defaults
11.10 +elif [ -e /etc/default/userinstall ]; then
11.11 + source /etc/default/userinstall
11.12 +else
11.13 + echo "No defaults found for userinstall."
11.14 + exit 1
11.15 +fi
11.16 +
11.17 +echo "Removing any linked /dev entry..."
11.18 +if [ -h "$PACKAGEROOT/dev" ]; then
11.19 + rm $PACKAGEROOT/dev
11.20 + mkdir $PACKAGEROOT/dev
11.21 +fi
11.22 +
11.23 +echo "Removing any linked /proc entry..."
11.24 +if [ -h "$PACKAGEROOT/proc" ]; then
11.25 + rm $PACKAGEROOT/proc
11.26 + mkdir $PACKAGEROOT/proc
11.27 +fi
11.28 +
11.29 +echo "Using a special fstab..."
11.30 +if [ -e "$PACKAGEROOT/etc/fstab" ]; then
11.31 + if [ ! -e "$PACKAGEROOT/etc/fstab.orig" ]; then
11.32 + mv $PACKAGEROOT/etc/fstab $PACKAGEROOT/etc/fstab.orig
11.33 + fi
11.34 +fi
11.35 +cp `dirname $0`/UML/fstab $PACKAGEROOT/etc/fstab
11.36 +
11.37 +# Tweak the inittab to only use tty0 and add it to securetty.
11.38 +echo "Reconfiguring the console settings..."
11.39 +if [ ! -e "$PACKAGEROOT/etc/inittab.orig" ]; then
11.40 + cp $PACKAGEROOT/etc/inittab $PACKAGEROOT/etc/inittab.orig
11.41 + grep -v "getty" $PACKAGEROOT/etc/inittab.save > $PACKAGEROOT/etc/inittab
11.42 + echo "# We launch just one console for UML:" >> $PACKAGEROOT/etc/inittab
11.43 + echo "c0:1235:respawn:/sbin/getty 38400 tty0 linux" >> $PACKAGEROOT/etc/inittab
11.44 +
11.45 + echo "# UML modification: use tty0 or vc/0" >> $PACKAGEROOT/etc/securetty
11.46 + echo "tty0" >> $PACKAGEROOT/etc/securetty
11.47 + echo "vc/0" >> $PACKAGEROOT/etc/securetty
11.48 +fi