Summary: Individual Service Upgrade support
Name: isu
-Version: 8.0.4
+Version: 8.0.5
Release: 1
Source0: %{name}-%{version}.tar.gz
License: MIT
return $res
}
+function fixup_permissions()
+{
+ local pkg_path="$1"
+ find "$pkg_path" \
+ \( -type f \( -exec chmod 644 '{}' \; -and -exec chsmack -a _ '{}' \; \) \) -o \
+ \( -type d \( -exec chmod 755 '{}' \; -and -exec chsmack -a _ '{}' \; \) \)
+ chmod 0400 "$pkg_path"/rootfs.img
+ return 0
+}
+
function install_pkg()
{
local pkg_file="$1"
local temp_path=$(mktemp -d)
if ! unzip "$pkg_file" -d "$temp_path" > /dev/null; then
- echo "ISU Package installation error"
+ echo "Unable to extract ISU package"
return $PKG_INSTALL_ERROR
fi
+
+ if ! fixup_permissions "$temp_path"; then
+ echo "Unable to santize ISU package files permissions"
+ return $PKG_INSTALL_ERROR
+ fi
+
local pkg_name=$(grep -e '^name' "$temp_path/isu.cfg" | head -n 1 | awk -F '=' '{gsub(/[ ]+/,""); print $2}')
if [ -z "$pkg_name" ]; then
echo "Invalid package name in isu.cfg"
local mount_unit="run-isu-$(systemd-escape ${isu_pkg_name})-rootfs.mount"
if [ ! -r "$UNITDIR/$mount_unit" ]; then
+
+ if ! test -r "$i"/rootfs.img; then
+ echo "Can not access rootfs.img. Skipping $isu_pkg_name"
+ return 1
+ fi
+
# generate mount unit for ISU image and extend the service file to use it
# if mount unit already exists, it means it's been generated by previous
# install_mount_unit() invocation - for the same ISU package, but different
echo "Public key verification succeeded for $isu_pkg_dir"
fi
- if [ -s "$cksum_path" ]; then
+ if [ -s "$cksum_path" ]; then
pushd "$isu_pkg_dir"
if ! sha256sum -c --status "$cksum_path"; then
popd
# assume isu packages are extracted
for i in "$PKGDIR"/*; do
- if ! test -d "$i" -a -r "$i"/rootfs.img -a -r "$i"/isu.cfg; then
+ if ! test -d "$i" -a -r "$i"/isu.cfg; then
echo "Can not access essential ISU package data. Skipping $PKGDIR"
continue
fi