[lxc-devel] [PATCH] Fedora template...
Michael H. Warfield
mhw at WittsEnd.com
Thu Apr 4 02:44:53 UTC 2013
Proposed patch to the Fedora template...
Purpose - Handle Fedora containers and Fedora Remix hosts on the
Raspberry Pi ARM platform.
Changes:
* Map armv6l and armv7l architectures to "arm" for yum and repos to
function properly.
* Detect Fedora Remix distros with no "/etc/fedora-release" file and
find proper release versions when "remix" part of the file context.
* Change default Fedora container on non-Fedora hosts to Fedora 17
(previous versions are unsupported on RPi or unstable on all platforms.
* Added code for autodev for Fedora systemd versions.
Proposed patch... Soliciting for comments...
Regards,
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | mhw at WittsEnd.com
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
--
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 684bb9c..e564160 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -32,12 +32,22 @@ default_path=@LXCPATH@
root_password=root
# is this fedora?
-[ -f /etc/fedora-release ] && is_fedora=true
-
-if [ "$arch" = "i686" ]; then
- arch=i386
+# Allow for weird remixes like the Raspberry Pi
+if [ -e /etc/redhat-release ]
+then
+ fedora_host_ver=$( sed -e '/^Fedora /!d' -e 's/Fedora.*\srelease\s*\([0-9][0-9]*\)\s.*/\1/' < /etc/redhat-release )
+ if [ "$fedora_host_ver" != "" ]
+ then
+ is_fedora=true
+ fi
fi
+# Map a few architectures to their generic Fedora repository archs.
+case "$arch" in
+i686) arch=i386 ;;
+armv6l|arm7l) arch=arm ;;
+esac
+
configure_fedora()
{
@@ -253,6 +263,8 @@ lxc.tty = 4
lxc.pts = 1024
lxc.mount = $config_path/fstab
+lxc.autodev = $auto_dev
+
# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined
@@ -374,14 +386,22 @@ if [ -z "$path" ]; then
fi
if [ -z "$release" ]; then
- if [ "$is_fedora" ]; then
- release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}')
+ if [ "$is_fedora" -a "$fedora_host_ver" ]; then
+ release=$fedora_host_ver
else
- echo "This is not a fedora host and release missing, defaulting to 14. use -R|--release to specify release"
- release=14
+ echo "This is not a fedora host and release missing, defaulting to 16. use -R|--release to specify release"
+ release=16
fi
fi
+# Fedora 15 and above run systemd. We need autodev enabled to keep
+# systemd from causing problems.
+if [ $release -gt 14 ]; then
+ auto_dev="1"
+else
+ auto_dev="0"
+fi
+
if [ "$(id -u)" != "0" ]; then
echo "This script should be run as 'root'"
exit 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130403/01ab6169/attachment.pgp>
More information about the lxc-devel
mailing list