-#!/bin/sh
+#!/bin/bash
key_sha256sums="9c102bcc376af1498d549b77bdbfa815ae86faa1d2d82f040e616b18ef2df2d4 alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
2adcf7ce224f476330b5360ca5edb92fd0bf91c92d83292ed028d7c4e26333ab alpine-devel@lists.alpinelinux.org-4d07755e.rsa.pub"
{
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 1
fi
return 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
return $?
}
# lock, so we won't purge while someone is creating a repository
(
- flock -x 200
+ flock -x 9
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1
echo -n "Purging the download cache for ALTLinux-$release..."
rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
exit 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
}
usage()
# ${1} - string to split
# ${2} - separator (default is ",")
# ${result} - result value on success
-function split_string {
+split_string() {
local ifs=${IFS}
IFS="${2:-,}"
read -a result < <(echo "${1}")
[ -f /etc/arch-release ] && is_arch=true
# Arch-specific preconfiguration for container
-function configure_arch {
+configure_arch() {
# read locale and timezone defaults from system rc.conf if running on Arch
if [ "${is_arch}" ]; then
cp -p /etc/vconsole.conf /etc/locale.conf /etc/locale.gen "${rootfs_path}/etc/"
}
# write container configuration files
-function copy_configuration {
+copy_configuration() {
mkdir -p "${config_path}"
cat > "${config_path}/config" << EOF
lxc.utsname=${name}
}
# install packages within container chroot
-function install_arch {
+install_arch() {
if ! pacstrap -dcC "${pacman_config}" "${rootfs_path}" ${base_packages[@]}; then
echo "Failed to install container packages"
return 1
# add necessary config files
mkdir $rootfs/etc/dropbear
- dropbearkey -t rsa -f $rootfs/etc/dropbear/dropbear_rsa_host_key &> /dev/null
- dropbearkey -t dss -f $rootfs/etc/dropbear/dropbear_dss_host_key &> /dev/null
+ dropbearkey -t rsa -f $rootfs/etc/dropbear/dropbear_rsa_host_key > /dev/null 2>&1
+ dropbearkey -t dss -f $rootfs/etc/dropbear/dropbear_dss_host_key > /dev/null 2>&1
echo "'dropbear' ssh utility installed"
fi
echo 0 > $rootfs_path/selinux/enforce
# Also kill it in the /etc/selinux/config file if it's there...
- if [[ -f $rootfs_path/etc/selinux/config ]]
+ if [ -f $rootfs_path/etc/selinux/config ]
then
sed -i '/^SELINUX=/s/.*/SELINUX=disabled/' $rootfs_path/etc/selinux/config
fi
{
mkdir -p /var/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 0
- ) 200>/var/lock/subsys/lxc-centos
+ ) 9>/var/lock/subsys/lxc-centos
return $?
}
# lock, so we won't purge while someone is creating a repository
(
- flock -x 200
+ flock -x 9
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1
rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
exit 0
- ) 200>/var/lock/subsys/lxc-centos
+ ) 9>/var/lock/subsys/lxc-centos
}
usage()
cat /etc/timezone > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
elif [ -f /etc/sysconfig/clock ]; then
- source /etc/sysconfig/clock
+ . /etc/sysconfig/clock
echo $ZONE > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
else
arch=$3
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-debian
return $?
}
# lock, so we won't purge while someone is creating a repository
(
- flock -x 200
+ flock -x 9
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1
rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
exit 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-debian
}
usage()
exit 0
fi
-if [ "$arch" == "i686" ]; then
+if [ "$arch" = "i686" ]; then
arch=i386
fi
-if [ "$arch" == "x86_64" ]; then
+if [ "$arch" = "x86_64" ]; then
arch=amd64
fi
set_guest_root_password()
{
- [[ -z "$root_password" ]] && return # pass is empty, abort
+ [ -z "$root_password" ] && return # pass is empty, abort
echo " - setting guest root password.."
echo "root passwd is: $root_password"
{
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 1
fi
return 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-openmandriva
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-openmandriva
return $?
}
# lock, so we won't purge while someone is creating a repository
(
- flock -x 200
+ flock -x 9
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1
echo -n "Purging the download cache for OpenMandriva-$release..."
rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
exit 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-openmandriva
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-openmandriva
}
usage()
Ignore: rpm:suse-build-key,build-key
Ignore: systemd:systemd-presets-branding
EOF
- if [ "$arch" == "i686" ]; then
+ if [ "$arch" = "i686" ]; then
mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i686/
for i in "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i586/*" ; do
ln -s $i $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i686/
rootfs=$1
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
fi
return 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
return $?
}
# lock, so we won't purge while someone is creating a repository
(
- flock -x 200
+ flock -x 9
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1
echo -n "Purging the download cache..."
rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
exit 0
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
}
usage()
-#!/bin/bash
+#!/bin/sh
#
# Template script for generating Oracle Enterprise Linux container for LXC
# based on lxc-fedora, lxc-ubuntu
chroot $container_rootfs useradd -m -s /bin/bash oracle
echo "oracle:oracle" | chroot $container_rootfs chpasswd
echo "root:root" | chroot $container_rootfs chpasswd
- echo -e "Added container user:\033[1moracle\033[0m password:\033[1moracle\033[0m"
- echo -e "Added container user:\033[1mroot\033[0m password:\033[1mroot\033[0m"
+ printf "Added container user:\033[1moracle\033[0m password:\033[1moracle\033[0m\n"
+ printf "Added container user:\033[1mroot\033[0m password:\033[1mroot\033[0m\n"
}
# create the container's lxc config file
mkdir -p @LOCALSTATEDIR@/lock/subsys/lxc
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
die "The template is busy."
fi
rm -f $container_rootfs/var/lib/rpm/__db*
chroot $container_rootfs rpm --rebuilddb >/dev/null 2>&1
- ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-$name
+ ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-$name
}
container_release_get()
exit 1
fi
-if [ $0 == "/sbin/init" ]; then
+if [ $0 = "/sbin/init" ]; then
PATH="$PATH:/bin:/sbin:/usr/sbin"
check_for_cmd @LXCINITDIR@/lxc/lxc-init
cat /etc/timezone > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
elif [ -f /etc/sysconfig/clock ]; then
- source /etc/sysconfig/clock
+ . /etc/sysconfig/clock
echo $ZONE > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
else
set -x
fi
-if [ "$arch" == "i686" ]; then
+if [ "$arch" = "i686" ]; then
arch=i386
fi
else
mkdir -p "$STATE_DIR/lock/subsys/"
(
- flock -x 200
+ flock -x 9
do_extract_rootfs
- ) 200>"$STATE_DIR/lock/subsys/lxc-ubuntu-cloud"
+ ) 9>"$STATE_DIR/lock/subsys/lxc-ubuntu-cloud"
fi
copy_configuration $path $rootfs $name $arch $release
mkdir -p $LOCALSTATEDIR/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 0
- ) 200>$LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release
+ ) 9>$LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release
return $?
}
cat /etc/timezone > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
elif [ -f /etc/sysconfig/clock ]; then
- source /etc/sysconfig/clock
+ . /etc/sysconfig/clock
echo $ZONE > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
else
fi
-if [ "$arch" == "i686" ]; then
+if [ "$arch" = "i686" ]; then
arch=i386
fi