#!/bin/sh # # chattr-lilo - postinst script for sure kernel install/upgrade # # Copyright (C) 2012-2014 Joachim Wiedorn # All rights reserved. # # Licensed under the terms contained in the file 'COPYING' # in the source directory. # set -e CHATTR=`which chattr` || exit 0 XFSINFO=`which xfs_info` || exit 0 if test -x $XFSINFO; then # check whether root partition is of xfs type [ `LANG=C $XFSINFO / | grep -c "attr="` -eq 1 ] || exit 0 fi # second argument gives the path and filename # first argument gives only the kernel version if [ -n "${2}" ]; then IMAGE="${2}" elif [ -n "${1}" ]; then IMAGE="/boot/vmlinuz-${1}" else echo "[postinst.d] do not execute chattr" exit 0 fi if [ -f "$IMAGE" ]; then echo "[postinst.d] chattr +i ${IMAGE}" >&2 $CHATTR +i "${IMAGE}" fi # end of file