Merge "4 spaces indent"
This commit is contained in:
commit
a719b9fa5f
30 changed files with 323 additions and 323 deletions
|
@ -5,9 +5,9 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if [ -e "/tmp/in_target.d/dib_environment" ]; then
|
||||
cp /tmp/in_target.d/dib_environment /etc/
|
||||
cp /tmp/in_target.d/dib_environment /etc/
|
||||
fi
|
||||
|
||||
if [ -e "/tmp/in_target.d/dib_arguments" ]; then
|
||||
cp /tmp/in_target.d/dib_arguments /etc/
|
||||
cp /tmp/in_target.d/dib_arguments /etc/
|
||||
fi
|
||||
|
|
|
@ -8,10 +8,10 @@ set -o pipefail
|
|||
DISTRO=`lsb_release -si` || true
|
||||
|
||||
case $DISTRO in
|
||||
'Ubuntu'|'Debian')
|
||||
# Note: add-apt-repository would be nice for RPM platforms too - so when we
|
||||
# need something like it, create a wrapper in dpkg/bin and fedora/bin.
|
||||
apt-get -y update
|
||||
install-packages python-software-properties
|
||||
;;
|
||||
'Ubuntu'|'Debian')
|
||||
# Note: add-apt-repository would be nice for RPM platforms too - so when we
|
||||
# need something like it, create a wrapper in dpkg/bin and fedora/bin.
|
||||
apt-get -y update
|
||||
install-packages python-software-properties
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -26,12 +26,12 @@ dest=$2
|
|||
time_cond=
|
||||
|
||||
if [ -p $dest ]; then
|
||||
type="fifo"
|
||||
tmp=$(mktemp --tmpdir download.XXXXXXXX)
|
||||
type="fifo"
|
||||
tmp=$(mktemp --tmpdir download.XXXXXXXX)
|
||||
else
|
||||
type="normal"
|
||||
mkdir -p $(dirname $dest)
|
||||
tmp=$(mktemp $(dirname $dest)/.download.XXXXXXXX)
|
||||
type="normal"
|
||||
mkdir -p $(dirname $dest)
|
||||
tmp=$(mktemp $(dirname $dest)/.download.XXXXXXXX)
|
||||
fi
|
||||
|
||||
if [ -f $dest -a -s $dest ] ; then
|
||||
|
@ -52,14 +52,14 @@ if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then
|
|||
else
|
||||
echo $success
|
||||
if [ "fifo" = "$type" ]; then
|
||||
cp $tmp $dest
|
||||
rm $tmp
|
||||
cp $tmp $dest
|
||||
rm $tmp
|
||||
else
|
||||
mv $tmp $dest
|
||||
mv $tmp $dest
|
||||
fi
|
||||
fi
|
||||
# 213 is the response to a ftp MDTM command, curl outputs a 213 as the status
|
||||
# if the url redirected to a ftp server and Not-Modified
|
||||
# 213 is the response to a ftp MDTM command, curl outputs a 213 as the status
|
||||
# if the url redirected to a ftp server and Not-Modified
|
||||
elif [ "$rcode" = "304" -o "$rcode" = "213" ] ; then
|
||||
echo "Server copy has not changed. Using locally cached $url"
|
||||
rm -f $tmp
|
||||
|
|
|
@ -20,46 +20,46 @@ fi
|
|||
ARGS="$0 $@"
|
||||
|
||||
function serialize_me() {
|
||||
if [ "$CONF_TYPE" == "eni" ]; then
|
||||
# Serialize runs so that we don't miss hot-add interfaces
|
||||
FLOCKED=${FLOCKED:-}
|
||||
if [ -z "$FLOCKED" ] ; then
|
||||
FLOCKED=true exec flock -x $ENI_FILE $ARGS
|
||||
fi
|
||||
fi
|
||||
if [ "$CONF_TYPE" == "eni" ]; then
|
||||
# Serialize runs so that we don't miss hot-add interfaces
|
||||
FLOCKED=${FLOCKED:-}
|
||||
if [ -z "$FLOCKED" ] ; then
|
||||
FLOCKED=true exec flock -x $ENI_FILE $ARGS
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function get_if_link() {
|
||||
cat /sys/class/net/${1}/carrier
|
||||
cat /sys/class/net/${1}/carrier
|
||||
}
|
||||
|
||||
function enable_interface() {
|
||||
local interface=$1
|
||||
local interface=$1
|
||||
|
||||
serialize_me
|
||||
if [ "$CONF_TYPE" == "eni" ]; then
|
||||
printf "auto $interface\niface $interface inet dhcp\n\n" >>$ENI_FILE
|
||||
elif [ "$CONF_TYPE" == "netscripts" ]; then
|
||||
printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"Ethernet\"" >"/etc/sysconfig/network-scripts/ifcfg-$interface"
|
||||
fi
|
||||
echo "Configured $1"
|
||||
serialize_me
|
||||
if [ "$CONF_TYPE" == "eni" ]; then
|
||||
printf "auto $interface\niface $interface inet dhcp\n\n" >>$ENI_FILE
|
||||
elif [ "$CONF_TYPE" == "netscripts" ]; then
|
||||
printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"Ethernet\"" >"/etc/sysconfig/network-scripts/ifcfg-$interface"
|
||||
fi
|
||||
echo "Configured $1"
|
||||
|
||||
}
|
||||
|
||||
function disable_interface() {
|
||||
local interface=$1
|
||||
local interface=$1
|
||||
|
||||
serialize_me
|
||||
if [ "$CONF_TYPE" == "netscripts" ]; then
|
||||
local IFCFG_FILE="/etc/sysconfig/network-scripts/ifcfg-$interface"
|
||||
if [ -f "$IFCFG_FILE" ]; then
|
||||
rm $IFCFG_FILE
|
||||
else
|
||||
echo "No link detected, skipping"
|
||||
fi
|
||||
else
|
||||
echo "No link detected, skipping"
|
||||
fi
|
||||
serialize_me
|
||||
if [ "$CONF_TYPE" == "netscripts" ]; then
|
||||
local IFCFG_FILE="/etc/sysconfig/network-scripts/ifcfg-$interface"
|
||||
if [ -f "$IFCFG_FILE" ]; then
|
||||
rm $IFCFG_FILE
|
||||
else
|
||||
echo "No link detected, skipping"
|
||||
fi
|
||||
else
|
||||
echo "No link detected, skipping"
|
||||
fi
|
||||
}
|
||||
|
||||
function config_exists() {
|
||||
|
@ -75,34 +75,34 @@ function config_exists() {
|
|||
}
|
||||
|
||||
function inspect_interface() {
|
||||
local interface=$1
|
||||
local mac_addr_type="$(cat /sys/class/net/${interface}/addr_assign_type)"
|
||||
local interface=$1
|
||||
local mac_addr_type="$(cat /sys/class/net/${interface}/addr_assign_type)"
|
||||
|
||||
echo -n "Inspecting interface: $interface..."
|
||||
if config_exists $interface; then
|
||||
echo "Has config, skipping."
|
||||
elif [ "$mac_addr_type" != "0" ]; then
|
||||
echo "Device has generated MAC, skipping."
|
||||
else
|
||||
ip link set dev $interface up &>/dev/null
|
||||
HAS_LINK="$(get_if_link $interface)"
|
||||
echo -n "Inspecting interface: $interface..."
|
||||
if config_exists $interface; then
|
||||
echo "Has config, skipping."
|
||||
elif [ "$mac_addr_type" != "0" ]; then
|
||||
echo "Device has generated MAC, skipping."
|
||||
else
|
||||
ip link set dev $interface up &>/dev/null
|
||||
HAS_LINK="$(get_if_link $interface)"
|
||||
|
||||
TRIES=10
|
||||
while [ "$HAS_LINK" == "0" -a $TRIES -gt 0 ]; do
|
||||
HAS_LINK="$(get_if_link $interface)"
|
||||
if [ "$HAS_LINK" == "1" ]; then
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
TRIES=$(( TRIES - 1 ))
|
||||
done
|
||||
if [ "$HAS_LINK" == "1" ] ; then
|
||||
enable_interface "$interface"
|
||||
else
|
||||
disable_interface "$interface"
|
||||
TRIES=10
|
||||
while [ "$HAS_LINK" == "0" -a $TRIES -gt 0 ]; do
|
||||
HAS_LINK="$(get_if_link $interface)"
|
||||
if [ "$HAS_LINK" == "1" ]; then
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
TRIES=$(( TRIES - 1 ))
|
||||
done
|
||||
if [ "$HAS_LINK" == "1" ] ; then
|
||||
enable_interface "$interface"
|
||||
else
|
||||
disable_interface "$interface"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -62,10 +62,10 @@ fi
|
|||
targets=$(find $target_dir -maxdepth 1 -xtype f -executable -printf '%f\n' | grep -E "$allowed_regex" | LANG=C sort -n || echo "")
|
||||
|
||||
if [ "$show_list" == "1" ] ; then
|
||||
for target in $targets ; do
|
||||
echo "${target_dir}/${target}"
|
||||
done
|
||||
exit 0
|
||||
for target in $targets ; do
|
||||
echo "${target_dir}/${target}"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PROFILE_DIR=$(mktemp -d /tmp/profiledir.XXXXXX)
|
||||
|
|
|
@ -9,19 +9,19 @@ modules=$(dkms status | tr ',:' ' ' | awk '{ print $1 "/" $2 }')
|
|||
kernels=$(ls /usr/src/linux-headers-*-*-* -d | sed -e 's|/usr/src/linux-headers-||' || echo "")
|
||||
# NOTE(bnemec): On Fedora, the versions can be found in /usr/src/kernels
|
||||
if [ -z "$kernels" ]; then
|
||||
kernels=$(ls /usr/src/kernels/* -d | sed -e 's|/usr/src/kernels/||' || echo "")
|
||||
kernels=$(ls /usr/src/kernels/* -d | sed -e 's|/usr/src/kernels/||' || echo "")
|
||||
fi
|
||||
if [ -z "$kernels" ]; then
|
||||
echo "Warning: No kernel versions found for DKMS"
|
||||
echo "Warning: No kernel versions found for DKMS"
|
||||
fi
|
||||
__ARCH=$ARCH
|
||||
unset ARCH
|
||||
|
||||
for module in $modules ; do
|
||||
for kernel in $kernels ; do
|
||||
dkms build $module -k $kernel
|
||||
dkms install $module -k $kernel
|
||||
done
|
||||
for kernel in $kernels ; do
|
||||
dkms build $module -k $kernel
|
||||
dkms install $module -k $kernel
|
||||
done
|
||||
done
|
||||
|
||||
ARCH=$__ARCH
|
||||
|
|
|
@ -20,18 +20,18 @@ set -o pipefail
|
|||
# install-packages package [package ...]
|
||||
|
||||
install_deb_packages () {
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
|
||||
no_proxy=${no_proxy:-} \
|
||||
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
|
||||
no_proxy=${no_proxy:-} \
|
||||
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
|
||||
}
|
||||
|
||||
if [ "$1" = "-u" ] ; then
|
||||
install_deb_packages dist-upgrade
|
||||
exit 0
|
||||
install_deb_packages dist-upgrade
|
||||
exit 0
|
||||
elif [ "$1" = "-e" ]; then
|
||||
install_deb_packages remove $@
|
||||
shift
|
||||
install_deb_packages remove $@
|
||||
shift
|
||||
else
|
||||
install_deb_packages install $@
|
||||
install_deb_packages install $@
|
||||
fi
|
||||
|
|
|
@ -13,7 +13,7 @@ IFCFG_FILE="/usr/lib/dracut/modules.d/45ifcfg/write-ifcfg.sh"
|
|||
NETGEN_FILE="/usr/lib/dracut/modules.d/40network/net-genrules.sh"
|
||||
|
||||
if patch --dry-run $NETGEN_FILE < $(dirname $0)/../dracut-029-netgen.patch > /dev/null; then
|
||||
patch $NETGEN_FILE < $(dirname $0)/../dracut-029-netgen.patch || true
|
||||
patch $NETGEN_FILE < $(dirname $0)/../dracut-029-netgen.patch || true
|
||||
else
|
||||
patch $IFCFG_FILE < $(dirname $0)/../dracut-write-ifcfg.patch || true
|
||||
patch $IFCFG_FILE < $(dirname $0)/../dracut-write-ifcfg.patch || true
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ set -o pipefail
|
|||
[ -n "$TARGET_ROOT" ]
|
||||
|
||||
if [ 'amd64' = "$ARCH" ] ; then
|
||||
ARCH="x86_64"
|
||||
ARCH="x86_64"
|
||||
fi
|
||||
|
||||
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""}
|
||||
|
|
|
@ -9,5 +9,5 @@ source $_LIB/die
|
|||
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"
|
||||
|
||||
if [ -e ~/.ssh/authorized_keys ]; then
|
||||
cat ~/.ssh/authorized_keys > $TMP_HOOKS_PATH/ssh-authorized-keys
|
||||
cat ~/.ssh/authorized_keys > $TMP_HOOKS_PATH/ssh-authorized-keys
|
||||
fi
|
||||
|
|
|
@ -6,8 +6,8 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then
|
||||
mkdir -p /root/.ssh
|
||||
cat /tmp/in_target.d/ssh-authorized-keys >> /root/.ssh/authorized_keys
|
||||
chmod 0700 /root/.ssh
|
||||
chmod 0600 /root/.ssh/authorized_keys
|
||||
mkdir -p /root/.ssh
|
||||
cat /tmp/in_target.d/ssh-authorized-keys >> /root/.ssh/authorized_keys
|
||||
chmod 0700 /root/.ssh
|
||||
chmod 0600 /root/.ssh/authorized_keys
|
||||
fi
|
||||
|
|
|
@ -13,60 +13,60 @@ http_proxy=${http_proxy:-""}
|
|||
https_proxy=${https_proxy:-""}
|
||||
|
||||
if [ -d /etc/apt ] ; then
|
||||
have_apt=1
|
||||
have_apt=1
|
||||
fi
|
||||
if [ -e /etc/yum.conf ] ; then
|
||||
have_yum=1
|
||||
have_yum=1
|
||||
fi
|
||||
if [ -d /etc/zypp ] ; then
|
||||
have_zypper=1
|
||||
have_zypper=1
|
||||
fi
|
||||
|
||||
if [ -n "$http_proxy" ]; then
|
||||
if [ -d ~stack ]; then
|
||||
echo export http_proxy=$http_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/02-use-http-proxy
|
||||
fi
|
||||
if [ -n "$have_yum" ] ; then
|
||||
sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^HTTP_PROXY=.*$,HTTP_PROXY=\"$http_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
if [ -d ~stack ]; then
|
||||
echo export http_proxy=$http_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/02-use-http-proxy
|
||||
fi
|
||||
if [ -n "$have_yum" ] ; then
|
||||
sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^HTTP_PROXY=.*$,HTTP_PROXY=\"$http_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$https_proxy" ]; then
|
||||
if [ -d ~stack ]; then
|
||||
echo export https_proxy=$https_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/02-use-https-proxy
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^HTTPS_PROXY=.*$,HTTPS_PROXY=\"$https_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
if [ -d ~stack ]; then
|
||||
echo export https_proxy=$https_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/02-use-https-proxy
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^HTTPS_PROXY=.*$,HTTPS_PROXY=\"$https_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
fi
|
||||
|
||||
no_proxy=${no_proxy:+"$no_proxy,192.0.2.1"}
|
||||
no_proxy=${no_proxy:-"192.0.2.1"}
|
||||
if [ -n "$no_proxy" ]; then
|
||||
if [ -d ~stack ]; then
|
||||
echo export no_proxy=$no_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
for host in $(sed 's/,/ /g' <<<$no_proxy); do
|
||||
echo "Acquire::http::Proxy::$host \"DIRECT\";" >> /etc/apt/apt.conf.d/02-no-proxy
|
||||
done
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^\(NO_PROXY=.*\)\"$,\1\, $no_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
if [ -d ~stack ]; then
|
||||
echo export no_proxy=$no_proxy >> ~stack/.profile
|
||||
fi
|
||||
if [ -n "$have_apt" ] ; then
|
||||
for host in $(sed 's/,/ /g' <<<$no_proxy); do
|
||||
echo "Acquire::http::Proxy::$host \"DIRECT\";" >> /etc/apt/apt.conf.d/02-no-proxy
|
||||
done
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^\(NO_PROXY=.*\)\"$,\1\, $no_proxy\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$http_proxy" -o -n "$https_proxy" -o -n "$no_proxy" ]; then
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^PROXY_ENABLED=.*$,PROXY_ENABLED=\"yes\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
if [ -n "$have_zypper" ] ; then
|
||||
sed -i -e "s,^PROXY_ENABLED=.*$,PROXY_ENABLED=\"yes\"," /etc/sysconfig/proxy
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -18,16 +18,16 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
function run_zypper() {
|
||||
# TODO: Uncertain if this can ever block wanting input from user
|
||||
zypper --non-interactive --gpg-auto-import-keys "$@"
|
||||
# TODO: Uncertain if this can ever block wanting input from user
|
||||
zypper --non-interactive --gpg-auto-import-keys "$@"
|
||||
}
|
||||
|
||||
if [ "$1" = "-u" ] ; then
|
||||
run_zypper dist-upgrade
|
||||
exit 0
|
||||
run_zypper dist-upgrade
|
||||
exit 0
|
||||
elif [ "$1" = "-d" ] ; then
|
||||
EXTRA_ARGS="--download-only"
|
||||
shift
|
||||
EXTRA_ARGS="--download-only"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Packages that aren't available in the distro but requested for installation
|
||||
|
@ -36,12 +36,12 @@ BLACKLIST=(dkms)
|
|||
WHITELIST=()
|
||||
for i in "$@"
|
||||
do
|
||||
if [[ ! ${BLACKLIST[*]} =~ $i ]]; then
|
||||
WHITELIST+="$i "
|
||||
else
|
||||
echo "The package $i is not available and will not be installed"
|
||||
fi
|
||||
if [[ ! ${BLACKLIST[*]} =~ $i ]]; then
|
||||
WHITELIST+="$i "
|
||||
else
|
||||
echo "The package $i is not available and will not be installed"
|
||||
fi
|
||||
done
|
||||
if [ -n "$WHITELIST" ]; then
|
||||
run_zypper install $EXTRA_ARGS $(map-packages $WHITELIST)
|
||||
run_zypper install $EXTRA_ARGS $(map-packages $WHITELIST)
|
||||
fi
|
||||
|
|
|
@ -7,6 +7,6 @@ export OPENSUSE_EXTRAS_PATH="$TMP_MOUNT_PATH/tmp/opensuse-extras"
|
|||
mkdir -p $OPENSUSE_EXTRAS_PATH
|
||||
|
||||
for file in common-defaults img-defaults ; do
|
||||
cp $_LIB/$file $OPENSUSE_EXTRAS_PATH
|
||||
cp $_LIB/$file $OPENSUSE_EXTRAS_PATH
|
||||
done
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ if [ -z "$DIB_OFFLINE" ] ; then
|
|||
# https://bugzilla.novell.com/show_bug.cgi?id=853882 is deployed
|
||||
echo "Looking up current built of Base Image ($BASE_IMAGE_NAME):"
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(curl $DIB_CLOUD_IMAGES | \
|
||||
sed -n "s/^.*\<a\ href\=\"\($BASE_IMAGE_NAME.*\.tbz\)\".*$/\1/p")}
|
||||
sed -n "s/^.*\<a\ href\=\"\($BASE_IMAGE_NAME.*\.tbz\)\".*$/\1/p")}
|
||||
if [ -n "$BASE_IMAGE_FILE" ]; then
|
||||
echo "Using base image: $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE"
|
||||
else
|
||||
echo -e "Failed to extract image file name from $DIB_CLOUD_IMAGES" \
|
||||
"\nPlease set BASE_IMAGE_FILE manually and retry."
|
||||
"\nPlease set BASE_IMAGE_FILE manually and retry."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
|
|
@ -5,8 +5,8 @@ set -o pipefail
|
|||
|
||||
PYPI_MIRROR_URL=${PYPI_MIRROR_URL:-''}
|
||||
if [ -n "$PYPI_MIRROR_URL" ]; then
|
||||
# External mirror URL being used - no need to bind mount anything.
|
||||
exit 0
|
||||
# External mirror URL being used - no need to bind mount anything.
|
||||
exit 0
|
||||
fi
|
||||
MIRROR_SOURCE=~/.cache/image-create/pypi/mirror/
|
||||
MIRROR_TARGET=$TMP_MOUNT_PATH/tmp/pypi
|
||||
|
|
|
@ -7,7 +7,7 @@ export RAMDISK_BUILD_PATH="$TMP_MOUNT_PATH/tmp/ramdisk-build"
|
|||
mkdir -p $RAMDISK_BUILD_PATH
|
||||
|
||||
for file in common-defaults common-functions ramdisk-defaults ramdisk-functions img-defaults img-functions ; do
|
||||
cp $_LIB/$file $RAMDISK_BUILD_PATH
|
||||
cp $_LIB/$file $RAMDISK_BUILD_PATH
|
||||
done
|
||||
|
||||
cp -r $(dirname $0)/scripts $RAMDISK_BUILD_PATH
|
||||
|
|
|
@ -7,39 +7,39 @@ set -o pipefail
|
|||
export TARGET_DIR="/tmp/in_target.d/"
|
||||
|
||||
if [ -z $TARGET_DIR ] ; then
|
||||
echo "Target dir not specified"
|
||||
exit 1
|
||||
echo "Target dir not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $TARGET_DIR ] ; then
|
||||
echo "Unable to find specified directory in target: $TARGET_DIR"
|
||||
bash
|
||||
exit 1
|
||||
echo "Unable to find specified directory in target: $TARGET_DIR"
|
||||
bash
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BINARY_DEPS=
|
||||
|
||||
for _FILE in $(ls ${TARGET_DIR}/binary-deps.d/) ; do
|
||||
_FILE="${TARGET_DIR}/binary-deps.d/${_FILE}"
|
||||
if [ -a $_FILE ]; then
|
||||
for _LINE in $(cat $_FILE) ; do
|
||||
BINARY_DEPS="${BINARY_DEPS} $_LINE"
|
||||
done
|
||||
fi
|
||||
_FILE="${TARGET_DIR}/binary-deps.d/${_FILE}"
|
||||
if [ -a $_FILE ]; then
|
||||
for _LINE in $(cat $_FILE) ; do
|
||||
BINARY_DEPS="${BINARY_DEPS} $_LINE"
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
for _BIN in $BINARY_DEPS ; do
|
||||
_LOCATION=$(which "$_BIN" || echo "")
|
||||
if [ -z "$_LOCATION" ]; then
|
||||
echo "$_BIN is not found in PATH. Please ensure your elements install it"
|
||||
exit 1
|
||||
fi
|
||||
_LOCATION=$(which "$_BIN" || echo "")
|
||||
if [ -z "$_LOCATION" ]; then
|
||||
echo "$_BIN is not found in PATH. Please ensure your elements install it"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$BINARY_DEPS" == "" ]; then
|
||||
echo "No binary-deps found"
|
||||
echo "No binary-deps found"
|
||||
else
|
||||
DEPS_OUTPUT="/etc/dib_binary_deps"
|
||||
echo "Creating binary_deps record at: ${DEPS_OUTPUT}"
|
||||
echo "$BINARY_DEPS" >${DEPS_OUTPUT}
|
||||
DEPS_OUTPUT="/etc/dib_binary_deps"
|
||||
echo "Creating binary_deps record at: ${DEPS_OUTPUT}"
|
||||
echo "$BINARY_DEPS" >${DEPS_OUTPUT}
|
||||
fi
|
||||
|
|
|
@ -84,5 +84,5 @@ fi
|
|||
echo "Extracting base root image from $CACHED_TAR"
|
||||
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $CACHED_TAR
|
||||
if [ -e "$TARGET_ROOT/lost+found" ]; then
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
fi
|
||||
|
|
|
@ -20,17 +20,17 @@ set -o xtrace
|
|||
dib-first-boot
|
||||
EOF
|
||||
|
||||
if [ $FILE_EXISTED ]
|
||||
then
|
||||
echo "mv $rc_local.REAL $rc_local" >> $rc_local
|
||||
else
|
||||
echo "rm \$0" >> $rc_local
|
||||
fi
|
||||
|
||||
echo "exit 0" >> $rc_local
|
||||
|
||||
chmod 755 $rc_local
|
||||
|
||||
# Enable the service
|
||||
systemctl enable rc-local.service
|
||||
if [ $FILE_EXISTED ]
|
||||
then
|
||||
echo "mv $rc_local.REAL $rc_local" >> $rc_local
|
||||
else
|
||||
echo "rm \$0" >> $rc_local
|
||||
fi
|
||||
|
||||
echo "exit 0" >> $rc_local
|
||||
|
||||
chmod 755 $rc_local
|
||||
|
||||
# Enable the service
|
||||
systemctl enable rc-local.service
|
||||
fi
|
||||
|
|
|
@ -4,9 +4,9 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]; then
|
||||
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
|
||||
rm -rf /etc/sysconfig/rhn/systemid
|
||||
else
|
||||
subscription-manager unregister
|
||||
fi
|
||||
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
|
||||
rm -rf /etc/sysconfig/rhn/systemid
|
||||
else
|
||||
subscription-manager unregister
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -4,52 +4,52 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]
|
||||
then
|
||||
then
|
||||
opts="--force"
|
||||
if [[ -n "$DIB_SAT_KEY" ]]; then
|
||||
opts="$opts --activationkey ${DIB_SAT_KEY}"
|
||||
opts="$opts --activationkey ${DIB_SAT_KEY}"
|
||||
else
|
||||
opts="$opts --username ${DIB_RHSM_USER} --password ${DIB_RHSM_PASSWORD}"
|
||||
opts="$opts --username ${DIB_RHSM_USER} --password ${DIB_RHSM_PASSWORD}"
|
||||
fi
|
||||
if [[ -n "$DIB_SAT_URL" ]]; then
|
||||
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
|
||||
opts="$opts --serverUrl ${DIB_SAT_URL}"
|
||||
else
|
||||
opts="$opts --serverurl ${DIB_SAT_URL} --sslCACert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
|
||||
fi
|
||||
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
|
||||
opts="$opts --serverUrl ${DIB_SAT_URL}"
|
||||
else
|
||||
opts="$opts --serverurl ${DIB_SAT_URL} --sslCACert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
|
||||
fi
|
||||
fi
|
||||
if [[ -n "$DIB_SAT_CERT_RPM_URL" ]]; then
|
||||
yum install -y ${DIB_SAT_CERT_RPM_URL}
|
||||
yum install -y ${DIB_SAT_CERT_RPM_URL}
|
||||
fi
|
||||
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
|
||||
rhnreg_ks $opts --norhnsd
|
||||
sleep 1
|
||||
# optional channel required for diskimage-builder dependency
|
||||
channels="-a -c rhel-x86_64-server-optional-6"
|
||||
if [[ -n "$DIB_RHN_CHANNELS" ]]; then
|
||||
for chan in $DIB_RHN_CHANNELS; do
|
||||
channels="$channels -a -c $chan"
|
||||
done
|
||||
fi
|
||||
rhn-channel --user=$DIB_RHSM_USER --password=$DIB_RHSM_PASSWORD $channels
|
||||
rhn-channel -l
|
||||
rhnreg_ks $opts --norhnsd
|
||||
sleep 1
|
||||
# optional channel required for diskimage-builder dependency
|
||||
channels="-a -c rhel-x86_64-server-optional-6"
|
||||
if [[ -n "$DIB_RHN_CHANNELS" ]]; then
|
||||
for chan in $DIB_RHN_CHANNELS; do
|
||||
channels="$channels -a -c $chan"
|
||||
done
|
||||
fi
|
||||
rhn-channel --user=$DIB_RHSM_USER --password=$DIB_RHSM_PASSWORD $channels
|
||||
rhn-channel -l
|
||||
else
|
||||
subscription-manager register $opts
|
||||
# wait a second to ensure consumer certificate is finished writing to disk
|
||||
sleep 1
|
||||
if [ -z $DIB_RHSM_POOL ]; then
|
||||
subscription-manager attach --auto
|
||||
else
|
||||
subscription-manager attach --pool $DIB_RHSM_POOL
|
||||
fi
|
||||
# optional repo required for diskimage-builder dependency
|
||||
repos="--enable rhel-6-server-optional-rpms"
|
||||
if [[ -n "$DIB_RHSM_REPOS" ]]; then
|
||||
for repo in $DIB_RHSM_REPOS; do
|
||||
repos="$repos --enable $repo"
|
||||
done
|
||||
fi
|
||||
subscription-manager repos $repos
|
||||
subscription-manager repos --list
|
||||
subscription-manager register $opts
|
||||
# wait a second to ensure consumer certificate is finished writing to disk
|
||||
sleep 1
|
||||
if [ -z $DIB_RHSM_POOL ]; then
|
||||
subscription-manager attach --auto
|
||||
else
|
||||
subscription-manager attach --pool $DIB_RHSM_POOL
|
||||
fi
|
||||
# optional repo required for diskimage-builder dependency
|
||||
repos="--enable rhel-6-server-optional-rpms"
|
||||
if [[ -n "$DIB_RHSM_REPOS" ]]; then
|
||||
for repo in $DIB_RHSM_REPOS; do
|
||||
repos="$repos --enable $repo"
|
||||
done
|
||||
fi
|
||||
subscription-manager repos $repos
|
||||
subscription-manager repos --list
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ set -o pipefail
|
|||
[ -n "$TARGET_ROOT" ]
|
||||
|
||||
if [ 'amd64' = "$ARCH" ] ; then
|
||||
ARCH="x86_64"
|
||||
ARCH="x86_64"
|
||||
fi
|
||||
|
||||
DIB_RELEASE=${DIB_RELEASE:-"6.5-20140121.0"}
|
||||
|
@ -38,8 +38,8 @@ else
|
|||
export LOOPDEV=$LOOPDEV
|
||||
echo "Loop device is set to: $LOOPDEV"
|
||||
if ! timeout 5 sh -c "while ! [ -e /dev/mapper/$LOOPDEV ]; do sleep 1; done"; then
|
||||
echo "Error: Could not find /dev/mapper/$LOOPDEV"
|
||||
exit 1
|
||||
echo "Error: Could not find /dev/mapper/$LOOPDEV"
|
||||
exit 1
|
||||
fi
|
||||
EACTION="sudo kpartx -d $WORKING/$RAW_FILE;$EACTION"
|
||||
trap "$EACTION" EXIT
|
||||
|
@ -56,5 +56,5 @@ fi
|
|||
# image tarball and host OS e.g. when building RHEL image on an openSUSE host)
|
||||
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_TAR
|
||||
if [ -e "$TARGET_ROOT/lost+found" ]; then
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ set -o pipefail
|
|||
[ -n "$TARGET_ROOT" ]
|
||||
|
||||
if [ 'amd64' = "$ARCH" ] ; then
|
||||
ARCH="x86_64"
|
||||
ARCH="x86_64"
|
||||
fi
|
||||
|
||||
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""}
|
||||
|
|
|
@ -4,16 +4,16 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if [ "i386" = "$ARCH" ]; then
|
||||
basearch=i386
|
||||
arch=i686
|
||||
basearch=i386
|
||||
arch=i686
|
||||
elif [ "amd64" = "$ARCH" ]; then
|
||||
basearch=x86_64
|
||||
arch=x86_64
|
||||
basearch=x86_64
|
||||
arch=x86_64
|
||||
else
|
||||
echo "********************"
|
||||
echo "Unknown arch '$ARCH'"
|
||||
echo "********************"
|
||||
exit 1
|
||||
echo "********************"
|
||||
echo "Unknown arch '$ARCH'"
|
||||
echo "********************"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $basearch > /etc/yum/vars/basearch
|
||||
|
|
|
@ -18,5 +18,5 @@ mv $rc_local.REAL $rc_local
|
|||
exit 0
|
||||
EOF
|
||||
|
||||
chmod 755 $rc_local
|
||||
chmod 755 $rc_local
|
||||
fi
|
||||
|
|
|
@ -7,9 +7,9 @@ set -eu
|
|||
set -o pipefail
|
||||
|
||||
if dpkg-query -W grub-pc; then
|
||||
apt-get -y remove grub-pc
|
||||
apt-get -y remove grub-pc
|
||||
fi
|
||||
|
||||
if dpkg-query -W grub2-common; then
|
||||
apt-get -y remove grub2-common
|
||||
apt-get -y remove grub2-common
|
||||
fi
|
||||
|
|
|
@ -18,16 +18,16 @@ CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
|||
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
|
||||
echo "Not checking freshness of cached $CACHED_FILE."
|
||||
else
|
||||
echo "Fetching Base Image"
|
||||
$TMP_HOOKS_PATH/bin/cache-url $SHA256SUMS $DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
|
||||
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE
|
||||
pushd $DIB_IMAGE_CACHE
|
||||
grep "$BASE_IMAGE_FILE" SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH | sha256sum --check -
|
||||
popd
|
||||
echo "Fetching Base Image"
|
||||
$TMP_HOOKS_PATH/bin/cache-url $SHA256SUMS $DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
|
||||
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE
|
||||
pushd $DIB_IMAGE_CACHE
|
||||
grep "$BASE_IMAGE_FILE" SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH | sha256sum --check -
|
||||
popd
|
||||
fi
|
||||
# Extract the base image (use --numeric-owner to avoid UID/GID mismatch between
|
||||
# image tarball and host OS e.g. when building Ubuntu image on an openSUSE host)
|
||||
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||
if [ -e "$TARGET_ROOT/lost+found" ]; then
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
sudo rmdir $TARGET_ROOT/lost+found
|
||||
fi
|
||||
|
|
|
@ -52,9 +52,9 @@ function install_extlinux {
|
|||
DEFAULT linux
|
||||
|
||||
LABEL linux
|
||||
KERNEL $kernel
|
||||
APPEND ro root=LABEL=cloudimg-rootfs console=tty0 console=ttyS0,115200
|
||||
INITRD $initrd
|
||||
KERNEL $kernel
|
||||
APPEND ro root=LABEL=cloudimg-rootfs console=tty0 console=ttyS0,115200
|
||||
INITRD $initrd
|
||||
_EOF_
|
||||
}
|
||||
|
||||
|
@ -89,35 +89,35 @@ function install_grub2 {
|
|||
# - and for UEFI too.
|
||||
# GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
||||
if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then
|
||||
# /sys/ comes from the host machine. If the host machine is using EFI
|
||||
# but the image being built doesn't have EFI boot-images installed we
|
||||
# should set the --target to use a BIOS-based boot-image.
|
||||
#
|
||||
# * --target tells grub what's the target platform
|
||||
# * the boot images are placed in /usr/lib/grub/<cpu>-<platform>
|
||||
# * i386-pc is used for BIOS-based machines
|
||||
# http://www.gnu.org/software/grub/manual/grub.html#Installation
|
||||
#
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
if [ ! -d /usr/lib/grub/*-efi ]; then
|
||||
case $ARCH in
|
||||
"x86_64"|"amd64")
|
||||
GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
||||
;;
|
||||
"i386")
|
||||
target=i386-pc
|
||||
if [ -e /proc/device-tree ]; then
|
||||
for x in /proc/device-tree/*; do
|
||||
if [ -e "$x" ]; then
|
||||
target="i386-ieee1275"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
GRUB_OPTS="$GRUB_OPTS --target=$target"
|
||||
;;
|
||||
esac
|
||||
# /sys/ comes from the host machine. If the host machine is using EFI
|
||||
# but the image being built doesn't have EFI boot-images installed we
|
||||
# should set the --target to use a BIOS-based boot-image.
|
||||
#
|
||||
# * --target tells grub what's the target platform
|
||||
# * the boot images are placed in /usr/lib/grub/<cpu>-<platform>
|
||||
# * i386-pc is used for BIOS-based machines
|
||||
# http://www.gnu.org/software/grub/manual/grub.html#Installation
|
||||
#
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
if [ ! -d /usr/lib/grub/*-efi ]; then
|
||||
case $ARCH in
|
||||
"x86_64"|"amd64")
|
||||
GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
||||
;;
|
||||
"i386")
|
||||
target=i386-pc
|
||||
if [ -e /proc/device-tree ]; then
|
||||
for x in /proc/device-tree/*; do
|
||||
if [ -e "$x" ]; then
|
||||
target="i386-ieee1275"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
GRUB_OPTS="$GRUB_OPTS --target=$target"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV
|
||||
|
@ -125,9 +125,9 @@ function install_grub2 {
|
|||
# This might be better factored out into a per-distro 'install-bootblock'
|
||||
# helper.
|
||||
if [ -d /boot/grub2 ]; then
|
||||
GRUB_CFG=/boot/grub2/grub.cfg
|
||||
GRUB_CFG=/boot/grub2/grub.cfg
|
||||
elif [ -d /boot/grub ]; then
|
||||
GRUB_CFG=/boot/grub/grub.cfg
|
||||
GRUB_CFG=/boot/grub/grub.cfg
|
||||
fi
|
||||
|
||||
DIST=`lsb_release -is`
|
||||
|
@ -136,15 +136,15 @@ function install_grub2 {
|
|||
echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub
|
||||
GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG"
|
||||
case $DIST in
|
||||
'Ubuntu'|'Debian')
|
||||
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
||||
GRUB_MKCONFIG=update-grub
|
||||
'Ubuntu'|'Debian')
|
||||
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
||||
GRUB_MKCONFIG=update-grub
|
||||
;;
|
||||
'Fedora')
|
||||
echo 'GRUB_CMDLINE_LINUX="nofb nomodeset vga=normal"' >>/etc/default/grub
|
||||
'Fedora')
|
||||
echo 'GRUB_CMDLINE_LINUX="nofb nomodeset vga=normal"' >>/etc/default/grub
|
||||
;;
|
||||
'openSUSE project')
|
||||
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
||||
'openSUSE project')
|
||||
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
||||
;;
|
||||
esac
|
||||
$GRUB_MKCONFIG
|
||||
|
@ -154,8 +154,8 @@ function install_grub2 {
|
|||
# grub-mkconfig generates a config with the device in it,
|
||||
# This shouldn't be needed, but old code has bugs
|
||||
if [ $RELEASE = 'precise' ] || [ $RELEASE = 'wheezy' ]; then
|
||||
sed -i "s%search --no.*%%" $GRUB_CFG
|
||||
sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG
|
||||
sed -i "s%search --no.*%%" $GRUB_CFG
|
||||
sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG
|
||||
fi
|
||||
# force use of a LABEL:
|
||||
# NOTE: Updating the grub config by hand once deployed should work, its just
|
||||
|
@ -164,15 +164,15 @@ function install_grub2 {
|
|||
sed -i "s%search --no-floppy --fs-uuid --set=root .*$%search --no-floppy --set=root --label cloudimg-rootfs%" $GRUB_CFG
|
||||
sed -i "s%root=UUID=[A-Za-z0-9\-]*%root=LABEL=cloudimg-rootfs%" $GRUB_CFG
|
||||
if [ "$DIST" = 'Fedora' ] ; then
|
||||
# enable serial console
|
||||
sed -i "s%LABEL=cloudimg-rootfs%LABEL=cloudimg-rootfs console=tty0 console=ttyS0,115200%" $GRUB_CFG
|
||||
if [ $(lsb_release -rs) = '19' ]; then
|
||||
sed -i "s%UUID=[A-Za-z0-9\-]*%LABEL=cloudimg-rootfs%" /etc/fstab
|
||||
fi
|
||||
# Fix efi specific instructions in grub config file
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG
|
||||
fi
|
||||
# enable serial console
|
||||
sed -i "s%LABEL=cloudimg-rootfs%LABEL=cloudimg-rootfs console=tty0 console=ttyS0,115200%" $GRUB_CFG
|
||||
if [ $(lsb_release -rs) = '19' ]; then
|
||||
sed -i "s%UUID=[A-Za-z0-9\-]*%LABEL=cloudimg-rootfs%" /etc/fstab
|
||||
fi
|
||||
# Fix efi specific instructions in grub config file
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@ EXTRA_ARGS=
|
|||
ACTION=install
|
||||
|
||||
if [ "$1" = "-u" ] ; then
|
||||
yum -y update
|
||||
exit 0
|
||||
yum -y update
|
||||
exit 0
|
||||
elif [ "$1" = "-d" ] ; then
|
||||
EXTRA_ARGS="--downloadonly"
|
||||
shift
|
||||
EXTRA_ARGS="--downloadonly"
|
||||
shift
|
||||
elif [ "$1" = "-e" ]; then
|
||||
ACTION=erase
|
||||
shift
|
||||
ACTION=erase
|
||||
shift
|
||||
fi
|
||||
|
||||
# Packages that aren't available in the distro but requested for installation
|
||||
|
@ -37,20 +37,20 @@ BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "")
|
|||
WHITELIST=()
|
||||
for i in "$@"
|
||||
do
|
||||
if [[ ! ${BLACKLIST[*]} =~ $i ]]; then
|
||||
WHITELIST+="$i "
|
||||
else
|
||||
echo "The package $i is not available and will not be installed"
|
||||
fi
|
||||
if [[ ! ${BLACKLIST[*]} =~ $i ]]; then
|
||||
WHITELIST+="$i "
|
||||
else
|
||||
echo "The package $i is not available and will not be installed"
|
||||
fi
|
||||
done
|
||||
if [ -n "$WHITELIST" ]; then
|
||||
if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ]; then
|
||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
|
||||
fi
|
||||
yum -y $ACTION $EXTRA_ARGS $(map-packages $WHITELIST)
|
||||
for pkg in "$@"; do
|
||||
if [ "$pkg" = "python-pip" ] ; then
|
||||
alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10
|
||||
if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ]; then
|
||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
|
||||
fi
|
||||
done
|
||||
yum -y $ACTION $EXTRA_ARGS $(map-packages $WHITELIST)
|
||||
for pkg in "$@"; do
|
||||
if [ "$pkg" = "python-pip" ] ; then
|
||||
alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue