Quoting Michael H. Warfield (m...@wittsend.com): > This took a lot longer for me to get around to it... Sorry. > > Patch to the lxc-fedora template. > > I didn't get any further comments from my earlier proposal, weeks ago, > and did get one addition based on comments about properly setting the > hostname in /etc/hostname, which I've added. I could have broken them > into separate patches but most are pretty small and minor. > > 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 > (Raspberry Pi) and find proper release versions when "remix" part of the > file context. > > * Change default Fedora container on non-Fedora hosts to Fedora 17. > > * Added code for autodev for Fedora systemd containers. > > * Added code to set /etc/hostname for Fedora > 14 (systemd). > > * Fix a few typos. > > Regards, > Mike > -- > Michael H. Warfield (AI4NB) | (770) 985-6132 | m...@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! > -- > > Signed-off-by: Michael H. Warfield <m...@wittsend.com>
Thanks, Michael. Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > > --- > diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in > index 684bb9c..a828dff 100644 > --- a/templates/lxc-fedora.in > +++ b/templates/lxc-fedora.in > @@ -32,12 +32,28 @@ default_path=@LXCPATH@ > root_password=root > > # is this fedora? > -[ -f /etc/fedora-release ] && is_fedora=true > - > -if [ "$arch" = "i686" ]; then > - arch=i386 > +# Alow 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. > +# The two ARM archs are a bit of a guesstimate for the v5 and v6 > +# archs. V6 should have hardware floating point (Rasberry Pi). > +# The "arm" arch is safer (no hardware floating point). So > +# there may be cases where we "get it wrong" for some v6 other > +# than RPi. > +case "$arch" in > +i686) arch=i386 ;; > +armv3l|armv4l|armv5l) arch=arm ;; > +armv6l|armv7l|armv8l) arch=armhfp ;; > +esac > + > configure_fedora() > { > > @@ -62,9 +78,15 @@ NETWORKING=yes > HOSTNAME=${name} > EOF > > + # set hostname on systemd Fedora systems > + if [ $release -gt 14 ]; then > + echo "${name}" > ${rootfs_path}/etc/hostname > + fi > + > # set minimal hosts > cat <<EOF > $rootfs_path/etc/hosts > 127.0.0.1 localhost $name > +::1 localhost6.localdomain6 localhost6 > EOF > > dev_path="${rootfs_path}/dev" > @@ -253,6 +275,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 > > @@ -320,7 +344,7 @@ Mandatory args: > Optional args: > -p,--path path to where the container rootfs will be created, > defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that > case > -c,--clean clean the cache > - -R,--release Fedora release for the new container. if the host is > Fedora, then it will defaultto the host's release. > + -R,--release Fedora release for the new container. if the host is > Fedora, then it will default to the host's release. > -A,--arch NOT USED YET. Define what arch the container will be > [i686,x86_64] > -h,--help print this help > EOF > @@ -365,7 +389,7 @@ fi > > if [ -n "$needed_pkgs" ]; then > echo "Missing commands: $needed_pkgs" > - echo "Please install these using \"sudo apt-get install $needed_pkgs\"" > + echo "Please install these using \"sudo yum install $needed_pkgs\"" > exit 1 > fi > > @@ -374,14 +398,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 > 17. use -R|--release to specify release" > + release=17 > 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 > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel