1 #!/bin/bash 2 # Usage: user-postsetup [ --root ] [ <country> ] 3 4 # Configuration: 5 if [ -e userinstall-defaults ]; then 6 source userinstall-defaults 7 elif [ -e /etc/default/userinstall ]; then 8 source /etc/default/userinstall 9 else 10 echo "No defaults found for userinstall." 11 exit 1 12 fi 13 14 if [[ $1 && $1 == '--root' ]]; then 15 export AS_ROOT=' --root' 16 export COUNTRY=$2 17 else 18 export COUNTRY=$1 19 fi 20 21 export THIS_DIR=`dirname $0` 22 23 echo "Copying host DNS configuration..." 24 cp /etc/resolv.conf $PACKAGEROOT/etc/ 25 26 echo "Copying filesystems configuration..." 27 cp /etc/fstab $PACKAGEROOT/etc/ 28 29 echo "Copying network configuration..." 30 cp /etc/hosts $PACKAGEROOT/etc/ 31 cp /etc/network/interfaces $PACKAGEROOT/etc/network/ 32 33 echo "Copying package repository configuration..." 34 if [[ $USERINSTALL_CODENAME == $DISTRIB_CODENAME ]]; then 35 cp /etc/apt/sources.list $PACKAGEROOT/etc/apt/ 36 elif [ -e $USERINSTALL_CODENAME/sources.list ]; then 37 cp $USERINSTALL_CODENAME/sources.list $PACKAGEROOT/etc/apt/ 38 else 39 echo "Attempting to generate a repository definition for $USERINSTALL_CODENAME." 40 $THIS_DIR/user-makesources $PACKAGEROOT/etc/apt/sources.list $COUNTRY 41 fi 42 43 if [[ $AS_ROOT ]]; then 44 echo "Mounting filesystems..." 45 $THIS_DIR/user-do$AS_ROOT mount -t proc proc /proc 46 fi 47 48 echo "Updating package details and upgrading..." 49 $THIS_DIR/user-do$AS_ROOT apt-get update 50 $THIS_DIR/user-do$AS_ROOT apt-get upgrade 51 52 if [[ $AS_ROOT ]]; then 53 echo "Configuring a root installation..." 54 $THIS_DIR/user-do$AS_ROOT apt-get install locales console-data 55 $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure locales 56 $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure tzdata 57 $THIS_DIR/user-do$AS_ROOT dpkg-reconfigure console-data 58 59 echo "Unmounting filesystems..." 60 $THIS_DIR/user-do$AS_ROOT umount /proc 61 fi