aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-10-19 09:45:43 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-10-19 09:45:43 +0000
commit688d54df37e4ceaec38ca2eeb501680ee26459d1 (patch)
treefc6dadec8caba48daf1a93793aac927bbff376c6 /main
parentd451866fd59af0b3c653dd94c0ee135b1e2d9ece (diff)
downloadaports-688d54df37e4ceaec38ca2eeb501680ee26459d1.tar.bz2
aports-688d54df37e4ceaec38ca2eeb501680ee26459d1.tar.xz
main/util-vserver: upgrade to 0.30.216_pre2994
also add supporrt for creating 32bit guests on x86_64 hosts
Diffstat (limited to 'main')
-rw-r--r--main/util-vserver/APKBUILD10
-rw-r--r--main/util-vserver/setup-vs-guest38
-rw-r--r--main/util-vserver/setup-vs-template5
3 files changed, 42 insertions, 11 deletions
diff --git a/main/util-vserver/APKBUILD b/main/util-vserver/APKBUILD
index b7c6ca369b..e4cfe43674 100644
--- a/main/util-vserver/APKBUILD
+++ b/main/util-vserver/APKBUILD
@@ -1,6 +1,6 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=util-vserver
-pkgver=0.30.216_pre2981
+pkgver=0.30.216_pre2994
_realver=${pkgver%_*}-${pkgver#*_}
pkgrel=0
pkgdesc="Linux-VServer admin utilities"
@@ -33,7 +33,7 @@ prepare() {
esac
done
msg "Running autotools..."
- aclocal -I m4 && autoconf && automake && libtoolize || return 1
+ libtoolize --force && aclocal -I m4 && autoconf && automake || return 1
# this is an ugly workaround
sed -i -e "s:as_echo=.*:as_echo=echo:g" configure
@@ -69,11 +69,11 @@ package() {
install -Dm755 ../setup-vs-guest "$pkgdir"/usr/sbin/setup-vs-guest
}
-md5sums="b9064c39a5ee4bfd5f98c419f3e7edfb util-vserver-0.30.216-pre2981.tar.bz2
+md5sums="c2801f089982043bd0528349a1c61bb7 util-vserver-0.30.216-pre2994.tar.bz2
73c7437dea6937a57cf38d166ef83c09 chmod.patch
ff8f561f672524eb46fe633f584ef60e ensc_pathprog.patch
da8b70c4fd40e68894b3903ffd121397 validate.patch
04000261fd990a3963b0e98260b481bd alpine.patch
3fc52e20d998f02995f21912738f5d36 bb-grep.patch
-49bca7969cc284adf68e0ef284c0660e setup-vs-template
-03e109447c2d500dfb27a3046170b92f setup-vs-guest"
+fae6626b724dec90a19924d68d355cd2 setup-vs-template
+ef35e154d1a221631a53f9c2cfbe9834 setup-vs-guest"
diff --git a/main/util-vserver/setup-vs-guest b/main/util-vserver/setup-vs-guest
index 0de3069ba5..8a41306699 100644
--- a/main/util-vserver/setup-vs-guest
+++ b/main/util-vserver/setup-vs-guest
@@ -153,7 +153,7 @@ valid_hostname() {
#
last_ipv4_addr_mask() {
local _iface=$1
- ip addr show dev $_iface | awk '$1 == "inet" {print $2}' | tail -n1
+ ip addr show dev $_iface | sort | awk '$1 == "inet" {print $2}' | tail -n1
}
valid_ip_and_prefix() {
@@ -235,8 +235,19 @@ ask_context() {
done
}
+ask_guest_arch() {
+ # get guest arch
+ while true; do
+ ask "Enter guest machine architecture (i686 or x86_64):" $_arch
+ case "$resp" in
+ i[3-6]86|x86_64) break;;
+ esac
+ echo "Only i[3-6]86 and x86_64 is supported"
+ done
+}
+
ask_template() {
- local temp
+ local temp= apk_arch= arch_opt=
# get template
while true; do
ask "Enter template file (or empty for generate a new):" \
@@ -246,11 +257,18 @@ ask_template() {
fi
echo "Can not read $resp"
done
+ if [ "$_guest_arch" != "$_arch" ]; then
+ case "$_guest_arch" in
+ i?86) apk_arch=x86;;
+ *) apk_arch=$_guest_arch;;
+ esac
+ arch_opt="-a $apk_arch"
+ fi
temp=$resp
if [ -z "$temp" ]; then
- temp=/vservers/template.tar.gz
+ temp=/vservers/template-$_guest_arch.tar.gz
echo "Generating template..."
- if setup-vs-template -q -o $temp; then
+ if setup-vs-template $arch_opt -q -o $temp; then
echo "ok"
else
echo "Failed to create template"
@@ -265,6 +283,8 @@ usage() {
exit 1
}
+_arch="$(uname -m)"
+
while getopts "h" opt; do
case "$opt" in
h) usage;;
@@ -289,6 +309,11 @@ while true; do
ask_context
_context=$resp
+ if [ "$_arch" = "x86_64" ]; then
+ ask_guest_arch
+ _guest_arch=$resp
+ fi
+
ask_template
_template=$resp
@@ -296,10 +321,15 @@ while true; do
--hostname $_hostname \
$_ifaceopts \
--context $_context \
+ $arch_opt \
-m template -- -t "$_template" -d alpine \
&& cp /etc/resolv.conf /vservers/$_hostname/etc/ \
&& cp /etc/apk/repositories /vservers/$_hostname/etc/apk/ \
|| exit 1
+ if [ "$_arch" != "$_guest_arch" ]; then
+ echo "linux_32bit" >> /etc/vservers/$_hostname/personality
+ echo "$_guest_arch" > /etc/vservers/$_hostname/uts/machine
+ fi
shift
[ $# -le 0 ] && exit 0
diff --git a/main/util-vserver/setup-vs-template b/main/util-vserver/setup-vs-template
index 8ad7f3fae8..3edffa1aaa 100644
--- a/main/util-vserver/setup-vs-template
+++ b/main/util-vserver/setup-vs-template
@@ -16,8 +16,9 @@ clean_exit() {
outfile=template.tar.gz
fakeroot=
repos=
-while getopts "ho:qX:" opt; do
+while getopts "a:ho:qX:" opt; do
case "$opt" in
+ a) arch_opt="--arch $OPTARG";;
h) usage 0;;
o) outfile="$OPTARG";;
q) quiet=-q;;
@@ -32,7 +33,7 @@ fi
tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/setup-vs-template-XXXXXX)
-apk add --root "$tmpdir" --initdb --keys-dir /etc/apk/keys -U \
+apk add --root "$tmpdir" --initdb --keys-dir /etc/apk/keys -U $arch_opt \
$quiet ${repos:---repositories-file /etc/apk/repositories} \
alpine-base $@ \
|| clean_exit 1