mirror of
https://github.com/lxc/lxc-templates.git
synced 2024-12-22 06:20:13 +00:00
Merge pull request #51 from fedya/master
adjust openmandriva.in template to the modern times
This commit is contained in:
commit
fbb2a909db
@ -8,8 +8,9 @@
|
||||
# lxc: linux Container library
|
||||
|
||||
# Authors:
|
||||
# Alexander Khryukin <alexander@mezon.ru>
|
||||
# Alexander Stefanov <alexander@mezon.ru>
|
||||
# Vokhmin Alexey V <avokhmin@gmail.com>
|
||||
# Bernhard Rosenkraenzer <bero@lindev.ch>
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -47,30 +48,14 @@ cache_base="${LXC_CACHE_PATH:-@LOCALSTATEDIR@/cache/lxc/openmandriva/$arch}"
|
||||
default_path=@LXCPATH@
|
||||
default_profile=default
|
||||
lxc_network_type=veth
|
||||
lxc_network_link=br0
|
||||
lxc_network_link=lxcbr0
|
||||
|
||||
# is this openmandriva?
|
||||
[ -f /etc/mandriva-release ] && is_openmandriva=true
|
||||
grep -q OpenMandriva /etc/os-release && is_openmandriva=true
|
||||
|
||||
configure_openmandriva()
|
||||
{
|
||||
mkdir -p ${rootfs_path}/etc/sysconfig/network-scripts/
|
||||
|
||||
# configure the network using the dhcp
|
||||
cat <<EOF > ${rootfs_path}/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
DEVICE=eth0
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=dhcp
|
||||
NM_CONTROLLED=no
|
||||
HOSTNAME=${utsname}
|
||||
EOF
|
||||
|
||||
# set the hostname
|
||||
cat <<EOF > ${rootfs_path}/etc/sysconfig/network
|
||||
NETWORKING=yes
|
||||
HOSTNAME=${utsname}
|
||||
EOF
|
||||
|
||||
echo "${utsname}" > ${rootfs_path}/etc/hostname
|
||||
|
||||
# set minimal hosts
|
||||
@ -98,13 +83,14 @@ populate_dev()
|
||||
mknod -m 666 ${dev_path}/tty2 c 4 2
|
||||
mknod -m 666 ${dev_path}/tty3 c 4 3
|
||||
mknod -m 666 ${dev_path}/tty4 c 4 4
|
||||
mknod -m 666 ${dev_path}/tty5 c 4 5
|
||||
mknod -m 666 ${dev_path}/tty6 c 4 6
|
||||
mknod -m 600 ${dev_path}/console c 5 1
|
||||
mknod -m 666 ${dev_path}/full c 1 7
|
||||
mknod -m 600 ${dev_path}/initctl p
|
||||
mknod -m 666 ${dev_path}/ptmx c 5 2
|
||||
mkdir -m 755 ${dev_path}/net
|
||||
mknod -m 666 ${dev_path}/net/tun c 10 200
|
||||
|
||||
}
|
||||
|
||||
set_guest_root_password()
|
||||
@ -126,15 +112,30 @@ create_chroot_openmandriva()
|
||||
echo "Failed to create '$INSTALL_ROOT' directory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Poor man's version of "dnf install --installroot=" --
|
||||
# need to get the repository configs from rpm packages
|
||||
# without having the repositories configured...
|
||||
PKGS=http://abf-downloads.rosalinux.ru/$release/repository/$arch/main/release/
|
||||
curl -s -L $PKGS |grep '^<a' |cut -d'"' -f2 >PACKAGES
|
||||
PRE_PACKAGES="rosa-repos"
|
||||
for i in $PRE_PACKAGES; do
|
||||
P=`grep "^$i-[0-9].*" PACKAGES`
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Can't find $i package for target" >&2
|
||||
exit 1
|
||||
fi
|
||||
curl -O $PKGS/$P
|
||||
rpm -r $INSTALL_ROOT -Uvh --ignorearch --nodeps $P
|
||||
done
|
||||
|
||||
# package list to install
|
||||
PKG_LIST="basesystem-minimal locales locales-en initscripts urpmi cronie dhcp-client kbd"
|
||||
PKG_LIST="basesystem-minimal locales locales-en systemd dnf networkmanager kbd"
|
||||
# download a mini openmandriva into a cache
|
||||
echo "Downloading openmandriva minimal ..."
|
||||
URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$release/repository/$arch/main/release"
|
||||
echo $URPMI
|
||||
URPMI_BASE="/usr/sbin/urpmi --no-suggests --no-verify-rpm --ignorearch --root $INSTALL_ROOT --urpmi-root $INSTALL_ROOT --auto $PKG_LIST"
|
||||
$URPMI
|
||||
$URPMI_BASE
|
||||
DNF="/usr/bin/dnf -y install --nogpgcheck --installroot=$INSTALL_ROOT --releasever=$release --forcearch=$arch $PKG_LIST"
|
||||
echo $DNF
|
||||
$DNF
|
||||
# We're splitting the old loop into two loops plus a directory retrival.
|
||||
# First loop... Try and retrive a mirror list with retries and a slight
|
||||
# delay between attempts...
|
||||
@ -147,7 +148,6 @@ create_chroot_openmandriva()
|
||||
echo "Download complete."
|
||||
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
copy_openmandriva()
|
||||
@ -162,7 +162,7 @@ copy_openmandriva()
|
||||
update_openmandriva()
|
||||
{
|
||||
echo "automated update in progress..."
|
||||
urpmi --root $cache/rootfs --urpmi-root $cache/rootfs --auto --auto-update --ignorearch
|
||||
dnf -y distro-sync --installroot=$cache/rootfs
|
||||
}
|
||||
|
||||
configure_openmandriva_systemd()
|
||||
@ -351,17 +351,6 @@ fi
|
||||
eval set -- "$options"
|
||||
|
||||
release=${release:-"cooker"}
|
||||
if [ -f /etc/lsb-release ]; then
|
||||
. /etc/lsb-release
|
||||
if [ "$DISTRIB_ID" = "OpenMandrivaLinux" ]; then
|
||||
release=openmandriva2013.0
|
||||
elif [ "$DISTRIB_ID" = "RosaDesktop.Fresh" ]; then
|
||||
release=rosa2012.1
|
||||
else
|
||||
echo "This is not an OpenMandriva or ROSA release"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
@ -408,8 +397,8 @@ if [ -z "$profile" ]; then
|
||||
profile=$default_profile
|
||||
fi
|
||||
|
||||
if [ $hostarch = "i586" -a $arch = "x86_64" ]; then
|
||||
echo "can't create x86_64 container on i586"
|
||||
if [ $hostarch = "i686" -a $arch = "x86_64" ]; then
|
||||
echo "can't create x86_64 container on i686"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user