Commit c71f845c by Andreas Freudenberg Committed by Stéphane Graber

templates: make shellcheck (Ubuntu: 0.3.7-5 amd64) most possible happy

parent d7538219
......@@ -158,7 +158,7 @@ EOF
echo "Timezone in container is not configured. Adjust it manually."
fi
echo "root:root" | chroot $rootfs chpasswd
echo "root:root" | chroot "$rootfs" chpasswd
echo "Root password is 'root', please change !"
return 0
......@@ -224,7 +224,8 @@ configure_debian_systemd()
# Fix getty-static-service as debootstrap does not install dbus
if [ -e "$rootfs//lib/systemd/system/getty-static.service" ] ; then
local tty_services=$(for i in $(seq 2 "$num_tty"); do echo -n "getty@tty${i}.service "; done; )
local tty_services
tty_services=$(for i in $(seq 2 "$num_tty"); do echo -n "getty@tty${i}.service "; done; )
sed 's/ getty@tty.*/'" $tty_services "'/g' \
"$rootfs/lib/systemd/system/getty-static.service" | \
sed 's/\(tty2-tty\)[5-9]/\1'"${num_tty}"'/g' > "$rootfs/etc/systemd/system/getty-static.service"
......@@ -253,8 +254,8 @@ configure_debian_systemd()
cleanup()
{
rm -rf $cache/partial-$release-$arch
rm -rf $cache/rootfs-$release-$arch
rm -rf "$cache/partial-$release-$arch"
rm -rf "$cache/rootfs-$release-$arch"
}
download_debian()
......@@ -315,9 +316,9 @@ openssh-server
# download a mini debian into a cache
echo "Downloading debian minimal ..."
debootstrap --verbose --variant=minbase --arch=$arch \
--include=$packages --keyring=${releasekeyring} \
"$release" "$cache/partial-$release-$arch" $MIRROR
debootstrap --verbose --variant=minbase --arch="$arch" \
--include="$packages" --keyring="${releasekeyring}" \
"$release" "$cache/partial-$release-$arch" "$MIRROR"
if [ $? -ne 0 ]; then
echo "Failed to download the rootfs, aborting."
return 1
......@@ -342,8 +343,8 @@ copy_debian()
# make a local copy of the minidebian
echo -n "Copying rootfs to $rootfs..."
mkdir -p $rootfs
rsync -Ha "$cache/rootfs-$release-$arch"/ $rootfs/ || return 1
mkdir -p "$rootfs"
rsync -Ha "$cache/rootfs-$release-$arch"/ "$rootfs"/ || return 1
return 0
}
......@@ -363,7 +364,7 @@ install_debian()
echo "Checking cache download in $cache/rootfs-$release-$arch ... "
if [ ! -e "$cache/rootfs-$release-$arch" ]; then
download_debian $cache $arch $release
download_debian "$cache" "$arch" "$release"
if [ $? -ne 0 ]; then
echo "Failed to download 'debian base'"
return 1
......@@ -394,7 +395,7 @@ copy_configuration()
# Generate the configuration file
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
nics=$(grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' "$path/config" | wc -l)
nics=$(grep -ce '^lxc\.network\.type[ \t]*=[ \t]*veth' "$path/config")
if [ "$nics" -eq 1 ]; then
grep -q "^lxc.network.hwaddr" "$path/config" || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" "$path/config"
fi
......@@ -452,23 +453,23 @@ EOF
fi
# Write a new sources.list containing both native and multiarch entries
> ${rootfs}/etc/apt/sources.list
> "${rootfs}/etc/apt/sources.list"
if [ "${arch}" = "${hostarch}" ]; then
write_sourceslist ${rootfs} ${release} ${arch}
write_sourceslist "${rootfs}" "${release}" "${arch}"
else
write_sourceslist "${rootfs}" "${release}"
fi
# Install Packages in container
if [ -n "${packages}" ]; then
local pack_list="$(echo "${packages}" | sed 's/,/ /g')"
local pack_list
pack_list="${packages//,/ }"
echo "Installing packages: ${pack_list}"
install_packages "${rootfs}" "${pack_list}"
fi
# Re-enable service startup
rm "${rootfs}/usr/sbin/policy-rc.d"
# end
}
......@@ -663,7 +664,7 @@ fi
configure_debian_systemd "$path" "$rootfs" "$config" $num_tty
post_process "${rootfs}" "${release}" ${arch} ${hostarch} ${packages}
post_process "${rootfs}" "${release}" "${arch}" "${hostarch}" "${packages}"
if [ ! -z "$clean" ]; then
clean || exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment