123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #!/bin/bash
- TEXTDOMAIN=vbootstrap
- TEXTDOMAINDIR=/usr/share/locale
- VERSION=@@VBOOTSTRAP_VERSION@@
- ##
- VBOOTSTRAPDIR="/usr/share/vbootstrap"
- SUPPORTED_VERSION="$(ls $VBOOTSTRAPDIR/scripts/)"
- ##
- usage()
- {
- echo "Usage: vbootstrap <version>_<arch> <url> <targetdir>"
- echo " supported <version>_<arch>:"
- for ver in $SUPPORTED_VERSION
- do
- echo " $ver"
- done
- }
- ##
- if [ "$(id -u)" != "0" ]
- then
- usage
- echo "E: You should run vbooststrap as super user."
- exit 0
- fi
- if ! [ $# -eq 3 ]
- then
- usage
- echo "E: You must specify a vine version, location and target."
- exit 0
- fi
- INSTVER=$1
- shift
- if [ -f "$VBOOTSTRAPDIR/scripts/$INSTVER" ]
- then
- source $VBOOTSTRAPDIR/scripts/$INSTVER
- else
- usage
- echo "E: $INSTVER is not supported."
- exit 0
- fi
- FETCHURL=$1
- shift
- INSTDIR=$1
- shift
- if [ -d "$INSTDIR" ]
- then
- echo "E: Specified directory \"$INSTDIR\" is already exists."
- usage
- exit 0
- fi
- ##
- APT_OPTS="
- -o Dir::Etc::sourcelist=$INSTDIR/etc/vbootstrap/sources.list.d/$INSTVER
- -o RPM::RootDir=$INSTDIR
- -o Dir::Etc::sourceparts=$INSTDIR/etc/apt/sources.list.d
- -o Dir::State=$INSTDIR/var/lib/apt
- -o Dir::Cache=$INSTDIR/var/cache/apt
- -o RPM::PM=\"external\"
- -o RPM::Install-Options::=--force
- -o RPM::Install-Options::=--nosignature "
- ##
- # generate source.list of $INSTVER
- mkdir -p $INSTDIR/etc/vbootstrap/sources.list.d
- sed -e "s,@@FETCHURL@@,${FETCHURL}," $VBOOTSTRAPDIR/sources.list.d/$INSTVER > $INSTDIR/etc/vbootstrap/sources.list.d/$INSTVER || exit 1
- # initialize rpm database
- echo $"Initializing RPM database in $INSTDIR."
- mkdir -p $INSTDIR/var/lib/rpm
- rpm --initdb --root $INSTDIR
- # update apt database
- echo $"update apt database."
- mkdir -p $INSTDIR/var/lib/apt/lists/partial
- mkdir -p $INSTDIR/var/cache/apt/archives/partial
- apt-get -qq $APT_OPTS update
- # misc setup files
- mkdir -p $INSTDIR/etc
- touch $INSTDIR/etc/mtab
- # create some device files
- mkdir $INSTDIR/dev
- mknod $INSTDIR/dev/null c 1 3
- mknod $INSTDIR/dev/console c 5 1
- # install base vine linux system.
- echo $"Installing basesystem."
- for i in $BASE_PKGS
- do
- apt-get -y -qq $APT_OPTS install $i
- done
- # run post install script
- vbootstrap_post
- echo $"vbootstrap done."
|