Commit edcf9b59 by Alexander Khryukin Committed by Stéphane Graber

minor cleanup in template and add systemd_configure function with openmandriva-related tricks

parent f1d8e7ed
...@@ -69,6 +69,7 @@ EOF ...@@ -69,6 +69,7 @@ EOF
populate_dev() populate_dev()
{ {
echo -n "Create devices in /dev/"
dev_path="${rootfs_path}/dev" dev_path="${rootfs_path}/dev"
rm -rf $dev_path rm -rf $dev_path
mkdir -p $dev_path mkdir -p $dev_path
...@@ -89,8 +90,7 @@ populate_dev() ...@@ -89,8 +90,7 @@ populate_dev()
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
return 0
} }
...@@ -99,7 +99,7 @@ set_guest_root_password() ...@@ -99,7 +99,7 @@ set_guest_root_password()
[[ -z "$root_password" ]] && return # pass is empty, abort [[ -z "$root_password" ]] && return # pass is empty, abort
echo -n " - setting guest root password.." echo -n " - setting guest root password.."
echo "root passwd is: $root_password" echo -n "root passwd is: $root_password"
echo "root:$root_password" | chroot "$rootfs_path" chpasswd echo "root:$root_password" | chroot "$rootfs_path" chpasswd
echo "done." echo "done."
} }
...@@ -114,10 +114,9 @@ create_chroot_openmandriva() ...@@ -114,10 +114,9 @@ create_chroot_openmandriva()
return 1 return 1
fi fi
# package list to install # package list to install
PKG_LIST="basesystem-minimal locales locales-en initscripts urpmi cronie dhcp-client" PKG_LIST="basesystem-minimal locales locales-en initscripts urpmi cronie dhcp-client 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/$distro/repository/$arch/main/release"
URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$release/repository/$arch/main/release" URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$release/repository/$arch/main/release"
echo $URPMI echo $URPMI
URPMI_BASE="/usr/sbin/urpmi --no-suggests --no-verify-rpm --ignorearch --root $INSTALL_ROOT --urpmi-root $INSTALL_ROOT --auto $PKG_LIST" URPMI_BASE="/usr/sbin/urpmi --no-suggests --no-verify-rpm --ignorearch --root $INSTALL_ROOT --urpmi-root $INSTALL_ROOT --auto $PKG_LIST"
...@@ -150,9 +149,26 @@ copy_openmandriva() ...@@ -150,9 +149,26 @@ copy_openmandriva()
update_openmandriva() update_openmandriva()
{ {
echo "automated update in progress..." echo "automated update in progress..."
# chroot $cache/rootfs urpmi --auto --auto-update urpmi --root $cache/rootfs urpmi-root $cache/rootfs --auto --auto-update --ignorearch
} }
configure_openmandriva_systemd()
{
chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd.service
chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket
chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket
# remove numlock service
# KDGKBLED: Inappropriate ioctl for device
rm -f ${rootfs_path}/etc/systemd/system/getty@.service.d/enable-numlock.conf
unlink ${rootfs_path}/etc/systemd/system/default.target
chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
sed -i 's!ConditionPathExists=/dev/tty0!ConditionPathExists=|/dev/tty0\nConditionVirtualization=|lxc!' \
${rootfs_path}/lib/systemd/system/getty\@.service
}
install_openmandriva() install_openmandriva()
{ {
mkdir -p @LOCALSTATEDIR@/lock/subsys/ mkdir -p @LOCALSTATEDIR@/lock/subsys/
...@@ -200,6 +216,7 @@ copy_configuration() ...@@ -200,6 +216,7 @@ copy_configuration()
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
cat <<EOF >> $config_path/config cat <<EOF >> $config_path/config
lxc.utsname = $name lxc.utsname = $name
lxc.autodev = 1
lxc.tty = 4 lxc.tty = 4
lxc.pts = 1024 lxc.pts = 1024
lxc.mount = $config_path/fstab lxc.mount = $config_path/fstab
...@@ -212,7 +229,7 @@ lxc.cap.drop = sys_module mac_admin mac_override sys_time ...@@ -212,7 +229,7 @@ lxc.cap.drop = sys_module mac_admin mac_override sys_time
lxc.network.type = $lxc_network_type lxc.network.type = $lxc_network_type
lxc.network.flags = up lxc.network.flags = up
lxc.network.link = $lxc_network_link lxc.network.link = $lxc_network_link
lxc.network.name = veth0 lxc.network.name = eth0
lxc.network.mtu = 1500 lxc.network.mtu = 1500
EOF EOF
if [ ! -z ${ipv4} ]; then if [ ! -z ${ipv4} ]; then
...@@ -366,6 +383,10 @@ if [ ! -z "$clean" -a -z "$path" ]; then ...@@ -366,6 +383,10 @@ if [ ! -z "$clean" -a -z "$path" ]; then
exit 0 exit 0
fi fi
if [ -z "${utsname}" ]; then
utsname=${name}
fi
type urpmi >/dev/null 2>&1 type urpmi >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "'urpmi' command is missing" echo "'urpmi' command is missing"
...@@ -425,6 +446,12 @@ if [ $? -ne 0 ]; then ...@@ -425,6 +446,12 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
# If the systemd configuration directory exists - set it up for what we need.
if [ -d ${rootfs_path}/etc/systemd/system ]
then
configure_openmandriva_systemd
fi
populate_dev populate_dev
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "failed to populated /dev/ devices" echo "failed to populated /dev/ devices"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment