mirror of
https://github.com/lxc/lxc-templates.git
synced 2025-04-28 10:27:16 +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
|
# lxc: linux Container library
|
||||||
|
|
||||||
# Authors:
|
# Authors:
|
||||||
# Alexander Khryukin <alexander@mezon.ru>
|
# Alexander Stefanov <alexander@mezon.ru>
|
||||||
# Vokhmin Alexey V <avokhmin@gmail.com>
|
# Vokhmin Alexey V <avokhmin@gmail.com>
|
||||||
|
# Bernhard Rosenkraenzer <bero@lindev.ch>
|
||||||
|
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@ -47,31 +48,15 @@ cache_base="${LXC_CACHE_PATH:-@LOCALSTATEDIR@/cache/lxc/openmandriva/$arch}"
|
|||||||
default_path=@LXCPATH@
|
default_path=@LXCPATH@
|
||||||
default_profile=default
|
default_profile=default
|
||||||
lxc_network_type=veth
|
lxc_network_type=veth
|
||||||
lxc_network_link=br0
|
lxc_network_link=lxcbr0
|
||||||
|
|
||||||
# is this openmandriva?
|
# is this openmandriva?
|
||||||
[ -f /etc/mandriva-release ] && is_openmandriva=true
|
grep -q OpenMandriva /etc/os-release && is_openmandriva=true
|
||||||
|
|
||||||
configure_openmandriva()
|
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
|
# set the hostname
|
||||||
cat <<EOF > ${rootfs_path}/etc/sysconfig/network
|
echo "${utsname}" > ${rootfs_path}/etc/hostname
|
||||||
NETWORKING=yes
|
|
||||||
HOSTNAME=${utsname}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "${utsname}" > ${rootfs_path}/etc/hostname
|
|
||||||
|
|
||||||
# set minimal hosts
|
# set minimal hosts
|
||||||
cat <<EOF > $rootfs_path/etc/hosts
|
cat <<EOF > $rootfs_path/etc/hosts
|
||||||
@ -98,13 +83,14 @@ populate_dev()
|
|||||||
mknod -m 666 ${dev_path}/tty2 c 4 2
|
mknod -m 666 ${dev_path}/tty2 c 4 2
|
||||||
mknod -m 666 ${dev_path}/tty3 c 4 3
|
mknod -m 666 ${dev_path}/tty3 c 4 3
|
||||||
mknod -m 666 ${dev_path}/tty4 c 4 4
|
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 600 ${dev_path}/console c 5 1
|
||||||
mknod -m 666 ${dev_path}/full c 1 7
|
mknod -m 666 ${dev_path}/full c 1 7
|
||||||
mknod -m 600 ${dev_path}/initctl p
|
mknod -m 600 ${dev_path}/initctl p
|
||||||
mknod -m 666 ${dev_path}/ptmx c 5 2
|
mknod -m 666 ${dev_path}/ptmx c 5 2
|
||||||
mkdir -m 755 ${dev_path}/net
|
mkdir -m 755 ${dev_path}/net
|
||||||
mknod -m 666 ${dev_path}/net/tun c 10 200
|
mknod -m 666 ${dev_path}/net/tun c 10 200
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_guest_root_password()
|
set_guest_root_password()
|
||||||
@ -126,15 +112,30 @@ create_chroot_openmandriva()
|
|||||||
echo "Failed to create '$INSTALL_ROOT' directory"
|
echo "Failed to create '$INSTALL_ROOT' directory"
|
||||||
return 1
|
return 1
|
||||||
fi
|
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
|
# 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
|
# download a mini openmandriva into a cache
|
||||||
echo "Downloading openmandriva minimal ..."
|
echo "Downloading openmandriva minimal ..."
|
||||||
URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$release/repository/$arch/main/release"
|
DNF="/usr/bin/dnf -y install --nogpgcheck --installroot=$INSTALL_ROOT --releasever=$release --forcearch=$arch $PKG_LIST"
|
||||||
echo $URPMI
|
echo $DNF
|
||||||
URPMI_BASE="/usr/sbin/urpmi --no-suggests --no-verify-rpm --ignorearch --root $INSTALL_ROOT --urpmi-root $INSTALL_ROOT --auto $PKG_LIST"
|
$DNF
|
||||||
$URPMI
|
|
||||||
$URPMI_BASE
|
|
||||||
# We're splitting the old loop into two loops plus a directory retrival.
|
# 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
|
# First loop... Try and retrive a mirror list with retries and a slight
|
||||||
# delay between attempts...
|
# delay between attempts...
|
||||||
@ -147,7 +148,6 @@ create_chroot_openmandriva()
|
|||||||
echo "Download complete."
|
echo "Download complete."
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_openmandriva()
|
copy_openmandriva()
|
||||||
@ -162,7 +162,7 @@ copy_openmandriva()
|
|||||||
update_openmandriva()
|
update_openmandriva()
|
||||||
{
|
{
|
||||||
echo "automated update in progress..."
|
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()
|
configure_openmandriva_systemd()
|
||||||
@ -351,17 +351,6 @@ fi
|
|||||||
eval set -- "$options"
|
eval set -- "$options"
|
||||||
|
|
||||||
release=${release:-"cooker"}
|
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
|
while true
|
||||||
do
|
do
|
||||||
@ -408,8 +397,8 @@ if [ -z "$profile" ]; then
|
|||||||
profile=$default_profile
|
profile=$default_profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $hostarch = "i586" -a $arch = "x86_64" ]; then
|
if [ $hostarch = "i686" -a $arch = "x86_64" ]; then
|
||||||
echo "can't create x86_64 container on i586"
|
echo "can't create x86_64 container on i686"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user