source: projects/vbootstrap/tags/0.0.16/vbootstrap.sh.in @ 118

Revision 118, 1.5 KB checked in by daisuke, 15 years ago (diff)

内部 CVS から import

Line 
1#!/bin/bash
2
3VERSION=@@VBOOTSTRAP_VERSION@@
4
5##
6
7VBOOTSTRAPDIR="/usr/share/vbootstrap"
8SUPPORTED_VERSION="$(ls $VBOOTSTRAPDIR/scripts/)"
9
10##
11
12usage()
13{
14  echo "Usage: vbootstrap <version> <targetdir>"
15  echo "  supported version:"
16  for ver in $SUPPORTED_VERSION
17  do
18    echo "    $ver"
19  done
20}
21
22##
23
24if [ "$(id -u)" != "0" ]
25then
26  usage
27  echo "E: You should run vbooststrap as super user."
28  exit 0
29fi
30
31if ! [ $# -eq 2 ]
32then
33  usage
34  echo "E: You must specify a vine version and target."
35  exit 0
36fi
37
38INSTVER=$1
39shift
40
41if [ -f "$VBOOTSTRAPDIR/scripts/$INSTVER" ]
42then
43  source $VBOOTSTRAPDIR/scripts/$INSTVER
44else
45  usage
46  echo "E: $INSTVER is not supported."
47  exit 0
48fi
49
50INSTDIR=$1
51shift
52
53if [ -d "$INSTDIR" ]
54then
55  echo "E: Specified directory \"$INSTDIR\" is already exists."
56  usage
57  exit 0
58fi
59
60##
61
62APT_OPTS="$APT_LINE -o RPM::RootDir=$INSTDIR -o Dir::Etc::sourceparts=$INSTDIR/etc/apt/sources.list.d "
63
64##
65
66# initialize rpm database
67echo "Initializing RPM database in $INSTDIR."
68mkdir -p $INSTDIR/var/lib/rpm
69rpm --initdb --root $INSTDIR
70
71# update apt database
72echo "update apt database."
73apt-get -qq $APT_OPTS update
74
75# misc setup files
76mkdir -p $INSTDIR/etc
77touch $INSTDIR/etc/mtab
78
79# create some device files
80mkdir $INSTDIR/dev
81mknod $INSTDIR/dev/null c 1 3
82mknod $INSTDIR/dev/console c 5 1
83
84# install base vine linux system.
85echo "Installing basesystem."
86for i in $BASE_PKGS
87do
88  apt-get -y -qq $APT_OPTS install $i
89done
90
91# run post install script
92vbootstrap_post
93
94echo "vboostrap done."
95
Note: See TracBrowser for help on using the repository browser.