Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c937991e
Commit
c937991e
authored
Apr 08, 2014
by
Dwight Engen
Committed by
Serge Hallyn
Apr 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-oracle: update to support OL7
Signed-off-by:
Dwight Engen
<
dwight.engen@oracle.com
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
e120d057
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
25 deletions
+70
-25
oracle.common.conf.in
config/templates/oracle.common.conf.in
+1
-1
lxc-oracle.in
templates/lxc-oracle.in
+69
-24
No files found.
config/templates/oracle.common.conf.in
View file @
c937991e
...
@@ -26,7 +26,7 @@ lxc.hook.clone = @LXCHOOKDIR@/clonehostname
...
@@ -26,7 +26,7 @@ lxc.hook.clone = @LXCHOOKDIR@/clonehostname
# lxc.cap.drop = audit_control # breaks sshd (set_loginuid failed)
# lxc.cap.drop = audit_control # breaks sshd (set_loginuid failed)
# lxc.cap.drop = audit_write
# lxc.cap.drop = audit_write
#
#
lxc.cap.drop = mac_admin mac_override
setfcap setpcap
lxc.cap.drop = mac_admin mac_override
lxc.cap.drop = sys_module sys_nice sys_pacct
lxc.cap.drop = sys_module sys_nice sys_pacct
lxc.cap.drop = sys_rawio sys_time
lxc.cap.drop = sys_rawio sys_time
...
...
templates/lxc-oracle.in
View file @
c937991e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
# Modified for Oracle Linux 5
# Modified for Oracle Linux 5
# Wim Coekaerts <wim.coekaerts@oracle.com>
# Wim Coekaerts <wim.coekaerts@oracle.com>
#
#
# Modified for Oracle Linux 6, combined OL4,5,6 into one template script
# Modified for Oracle Linux 6,
7
combined OL4,5,6 into one template script
# Dwight Engen <dwight.engen@oracle.com>
# Dwight Engen <dwight.engen@oracle.com>
#
#
# This library is free software; you can redistribute it and/or
# This library is free software; you can redistribute it and/or
...
@@ -84,7 +84,7 @@ container_rootfs_patch()
...
@@ -84,7 +84,7 @@ container_rootfs_patch()
mkdir
-p
$container_rootfs
/usr/lib/yum-plugins
mkdir
-p
$container_rootfs
/usr/lib/yum-plugins
cp
@DATADIR@/lxc/lxc-patch.py
$container_rootfs
/usr/lib/yum-plugins
cp
@DATADIR@/lxc/lxc-patch.py
$container_rootfs
/usr/lib/yum-plugins
fi
fi
if
[
$container_release_major
=
"6"
]
;
then
if
[
$container_release_major
-ge
"6"
]
;
then
mkdir
-p
$container_rootfs
/usr/share/yum-plugins
mkdir
-p
$container_rootfs
/usr/share/yum-plugins
cp
@DATADIR@/lxc/lxc-patch.py
$container_rootfs
/usr/share/yum-plugins
cp
@DATADIR@/lxc/lxc-patch.py
$container_rootfs
/usr/share/yum-plugins
fi
fi
...
@@ -92,7 +92,7 @@ container_rootfs_patch()
...
@@ -92,7 +92,7 @@ container_rootfs_patch()
cat
<<
EOF
>
$container_rootfs
/etc/yum/pluginconf.d/lxc-patch.conf
cat
<<
EOF
>
$container_rootfs
/etc/yum/pluginconf.d/lxc-patch.conf
[main]
[main]
enabled=1
enabled=1
packages=
initscripts,iptables,selinux-policy,readahead,udev
,util-linux-ng
packages=
dbus,initscripts,iptables,openssh-server,setup,selinux-policy,readahead,udev,util-linux
,util-linux-ng
EOF
EOF
fi
fi
...
@@ -140,6 +140,40 @@ EOF
...
@@ -140,6 +140,40 @@ EOF
ln
-s
/bin/false
$container_rootfs
/usr/sbin/selinuxenabled
ln
-s
/bin/false
$container_rootfs
/usr/sbin/selinuxenabled
fi
fi
# ensure /dev/ptmx refers to the newinstance devpts of the container, or
# pty's will get crossed up with the hosts (https://lkml.org/lkml/2012/1/23/512)
rm
-f
$container_rootfs
/dev/ptmx
ln
-s
pts/ptmx
$container_rootfs
/dev/ptmx
# OL7 has systemd, no rc.sysinit
if
[
$container_release_major
=
"7"
]
;
then
# from mhw in the fedora template: We do need to disable the
# "ConditionalPathExists=/dev/tty0" line or no gettys are started on
# the ttys in the container. Lets do it in an override copy of the
# service so it can still pass rpm verifies and not be automatically
# updated by a new systemd version.
sed
-e
's/^ConditionPathExists=/#LXC ConditionPathExists=/'
\
<
$container_rootfs
/usr/lib/systemd/system/getty
\@
.service
\
>
$container_rootfs
/etc/systemd/system/getty
\@
.service
# Setup getty service on the 4 ttys we are going to allow in the
# default config. Number should match lxc.tty
(
cd
$container_rootfs
/etc/systemd/system/getty.target.wants
for
i
in
1 2 3 4
;
do
ln
-sf
../getty
\@
.service getty@tty
${
i
}
.service
;
done
)
# disable some systemd services, set default boot, sigpwr target
rm
-f
$container_rootfs
/usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service
chroot
$container_rootfs
systemctl
-q
disable graphical.target
chroot
$container_rootfs
systemctl
-q
enable
multi-user.target
if
[
!
-e
$container_rootfs
/etc/systemd/system/sigpwr.target
]
;
then
chroot
$container_rootfs
ln
-s
/usr/lib/systemd/system/halt.target /etc/systemd/system/sigpwr.target
fi
# systemd in userns won't be able to set /proc/self/oom_score_adj which
# prevents the dbus service from starting
sed
-i
's|^OOMScoreAdjust|#LXC OOMScoreAdjust|'
$container_rootfs
/usr/lib/systemd/system/dbus.service
return
fi
# silence error in checking for selinux
# silence error in checking for selinux
sed
-i
's|cat /proc/self/attr/current|cat /proc/self/attr/current 2>/dev/null|'
$container_rootfs
/etc/rc.sysinit
sed
-i
's|cat /proc/self/attr/current|cat /proc/self/attr/current 2>/dev/null|'
$container_rootfs
/etc/rc.sysinit
sed
-i
's|cat /proc/self/attr/current|cat /proc/self/attr/current 2>/dev/null|'
$container_rootfs
/etc/rc.d/rc.sysinit
sed
-i
's|cat /proc/self/attr/current|cat /proc/self/attr/current 2>/dev/null|'
$container_rootfs
/etc/rc.d/rc.sysinit
...
@@ -253,6 +287,20 @@ EOF
...
@@ -253,6 +287,20 @@ EOF
# don't try to unmount swap
# don't try to unmount swap
sed
-i
's|\[ -f /proc/swaps \]|# LXC [ -f /proc/swaps ]|'
$container_rootfs
/etc/init.d/halt
sed
-i
's|\[ -f /proc/swaps \]|# LXC [ -f /proc/swaps ]|'
$container_rootfs
/etc/init.d/halt
# sem_open(3) checks that /dev/shm is SHMFS_SUPER_MAGIC, so make sure to
# mount /dev/shm (normally done by dracut initrd) as tmpfs
if
[
$container_release_major
=
"4"
-o
$container_release_major
=
"5"
]
;
then
grep
-q
"mount -t tmpfs tmpfs /dev/shm"
$container_rootfs
/etc/rc.sysinit
if
[
$?
-eq
1
]
;
then
echo
"mount -t tmpfs tmpfs /dev/shm"
>>
$container_rootfs
/etc/rc.sysinit
echo
"mount -t tmpfs tmpfs /dev/shm"
>>
$container_rootfs
/etc/rc.d/rc.sysinit
fi
fi
if
[
$container_release_major
=
"6"
]
;
then
sed
-i
's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|'
$container_rootfs
/etc/rc.sysinit
sed
-i
's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|'
$container_rootfs
/etc/rc.d/rc.sysinit
fi
# there might be other services that are useless but the below set is a good start
# there might be other services that are useless but the below set is a good start
# some of these might not exist in the image, so we silence chkconfig complaining
# some of these might not exist in the image, so we silence chkconfig complaining
# about the service file not being found
# about the service file not being found
...
@@ -269,11 +317,6 @@ EOF
...
@@ -269,11 +317,6 @@ EOF
do
do
chroot
$container_rootfs
chkconfig 2>/dev/null
$service
on
chroot
$container_rootfs
chkconfig 2>/dev/null
$service
on
done
done
# ensure /dev/ptmx refers to the newinstance devpts of the container, or
# pty's will get crossed up with the hosts (https://lkml.org/lkml/2012/1/23/512)
rm
-f
$container_rootfs
/dev/ptmx
ln
-s
pts/ptmx
$container_rootfs
/dev/ptmx
}
}
container_rootfs_configure
()
container_rootfs_configure
()
...
@@ -307,19 +350,7 @@ EOF
...
@@ -307,19 +350,7 @@ EOF
touch
$container_rootfs
/etc/mtab
touch
$container_rootfs
/etc/mtab
# don't put devpts,proc, nor sysfs in here, it will already be mounted for us by lxc/libvirt
# don't put devpts,proc, nor sysfs in here, it will already be mounted for us by lxc/libvirt
cat
<<
EOF
>
$container_rootfs
/etc/fstab
echo
""
>
$container_rootfs
/etc/fstab
EOF
# sem_open(3) checks that /dev/shm is SHMFS_SUPER_MAGIC, so make sure to mount /dev/shm (normally done by dracut initrd) as tmpfs
if
[
$container_release_major
=
"4"
-o
$container_release_major
=
"5"
]
;
then
echo
"mount -t tmpfs tmpfs /dev/shm"
>>
$container_rootfs
/etc/rc.sysinit
echo
"mount -t tmpfs tmpfs /dev/shm"
>>
$container_rootfs
/etc/rc.d/rc.sysinit
fi
if
[
$container_release_major
=
"6"
]
;
then
sed
-i
's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|'
$container_rootfs
/etc/rc.sysinit
sed
-i
's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|'
$container_rootfs
/etc/rc.d/rc.sysinit
fi
# setup console and tty[1-4] for login. note that /dev/console and
# setup console and tty[1-4] for login. note that /dev/console and
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
...
@@ -373,7 +404,7 @@ EOF
...
@@ -373,7 +404,7 @@ EOF
# /com/ubuntu/upstart socket.
# /com/ubuntu/upstart socket.
if
[
$container_release_major
=
"4"
-o
$container_release_major
=
"5"
]
;
then
if
[
$container_release_major
=
"4"
-o
$container_release_major
=
"5"
]
;
then
sed
-i
's|pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; |pf::powerfail:/sbin/shutdown -f -h now "|'
$container_rootfs
/etc/inittab
sed
-i
's|pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; |pf::powerfail:/sbin/shutdown -f -h now "|'
$container_rootfs
/etc/inittab
el
se
el
if
[
$container_release_major
=
"6"
]
;
then
cat
<<
EOF
>
$container_rootfs
/etc/init/power-status-changed.conf
cat
<<
EOF
>
$container_rootfs
/etc/init/power-status-changed.conf
# power-status-changed - used to cleanly shut down the container
# power-status-changed - used to cleanly shut down the container
#
#
...
@@ -405,7 +436,6 @@ EOF
...
@@ -405,7 +436,6 @@ EOF
mkdir
-m
755
$dev_path
/pts
mkdir
-m
755
$dev_path
/pts
mkdir
-m
1777
$dev_path
/shm
mkdir
-m
1777
$dev_path
/shm
mknod
-m
666
$dev_path
/tty c 5 0
mknod
-m
666
$dev_path
/tty c 5 0
mknod
-m
666
$dev_path
/tty0 c 4 0
mknod
-m
666
$dev_path
/tty1 c 4 1
mknod
-m
666
$dev_path
/tty1 c 4 1
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
...
@@ -460,6 +490,17 @@ EOF
...
@@ -460,6 +490,17 @@ EOF
echo
"lxc.cap.drop = sys_resource"
>>
$cfg_dir
/config
echo
"lxc.cap.drop = sys_resource"
>>
$cfg_dir
/config
fi
fi
# systemd services like logind and journald need these
if
[
$container_release_major
!=
"7"
]
;
then
echo
"lxc.cap.drop = setfcap setpcap"
>>
$cfg_dir
/config
fi
# don't create kmsg symlink as it causes journald to use 100% cpu
if
[
$container_release_major
=
"7"
]
;
then
echo
"lxc.autodev = 1"
>>
$cfg_dir
/config
echo
"lxc.kmsg = 0"
>>
$cfg_dir
/config
fi
echo
"# Networking"
>>
$cfg_dir
/config
echo
"# Networking"
>>
$cfg_dir
/config
# see if the network settings were already specified
# see if the network settings were already specified
lxc_network_type
=
`
grep
'^lxc.network.type'
$cfg_dir
/config |
awk
-F
'[= \t]+'
'{ print $2 }'
`
lxc_network_type
=
`
grep
'^lxc.network.type'
$cfg_dir
/config |
awk
-F
'[= \t]+'
'{ print $2 }'
`
...
@@ -577,7 +618,7 @@ container_rootfs_create()
...
@@ -577,7 +618,7 @@ container_rootfs_create()
mkdir
-p
$container_rootfs
/etc/yum.repos.d
mkdir
-p
$container_rootfs
/etc/yum.repos.d
wget
-q
$yum_url
/
$repofile
-O
$container_rootfs
/etc/yum.repos.d/
$repofile
wget
-q
$yum_url
/
$repofile
-O
$container_rootfs
/etc/yum.repos.d/
$repofile
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
die
"
Failed to download repo file
$yum_url
/
$repofi
le
"
die
"
Unable to download repo file
$yum_url
/
$repofile
, release unavailab
le"
fi
fi
# yum will take $basearch from host, so force the arch we want
# yum will take $basearch from host, so force the arch we want
...
@@ -691,6 +732,9 @@ container_rootfs_create()
...
@@ -691,6 +732,9 @@ container_rootfs_create()
chroot
$container_rootfs
rpm
--rebuilddb
>
/dev/null 2>&1
chroot
$container_rootfs
rpm
--rebuilddb
>
/dev/null 2>&1
)
9>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-
$name
)
9>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-
$name
if
[
$?
-ne
0
]
;
then
exit
1
fi
}
}
container_release_get
()
container_release_get
()
...
@@ -728,6 +772,7 @@ usage()
...
@@ -728,6 +772,7 @@ usage()
-h|--help
-h|--help
Release is of the format "major.minor", for example "5.8", "6.3", or "6.latest"
Release is of the format "major.minor", for example "5.8", "6.3", or "6.latest"
This template supports Oracle Linux releases 4.6 - 7.0
EOF
EOF
return
0
return
0
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment