#!/bin/bash UPGRADEBIN=@LIBEXECDIR@/system-upgrade-powerel TOOL_VERSION=@VERSION@ check() { [ -x $UPGRADEBIN ] || return 1 return 255 } depends() { echo plymouth } install() { # write our version info somewhere { echo NAME=\"powerel-upgrade-tool\" echo VERSION=\"$TOOL_VERSION\" echo ID=powerel-upgrade-dracut echo VERSION_ID=$TOOL_VERSION echo PRETTY_NAME=\"powerel-upgrade-dracut-$TOOL_VERSION\" echo ANSI_COLOR=\"0\;36\" } > $initdir/etc/system-upgrade-release # stuff we need for initial boot # ------------------------------ # SELinux policy and contexts dracut_install /etc/selinux/config dracut_install /etc/selinux/*/policy/* dracut_install $(find /etc/selinux/*/contexts) # script to save initramfs at UPGRADEROOT inst_hook pre-pivot 99 "$moddir/keep-initramfs.sh" # remove the plymouth text plugin so we get either graphics or details rm -r ${initdir}/$(plymouth --get-splash-plugin-path)text.so \ ${initdir}/usr/share/plymouth/themes/text/* # stuff we use in upgrade hook(s) # ------------------------------- # upgrader binary inst_binary $UPGRADEBIN # config file so we can find it mkdir -p "${initdir}/etc/conf.d" echo "UPGRADEBIN=$UPGRADEBIN" > "${initdir}/etc/conf.d/powerel-upgrade-tool.conf" # RPM hash/sig checks (via NSS) don't work without these inst_libdir_file "libfreebl*" "libsqlite*" "libsoftokn*" # RPM can't find the rpmdb without rpmconfig rpmconfig=$(find /etc/rpm /usr/lib/rpm -name "rpmrc" -o -name "macros*") dracut_install $rpmconfig # script to run before the upgrade inst_hook upgrade-pre 50 "$moddir/prepare-rootfs.sh" # script to actually run the upgrader binary inst_hook upgrade 50 "$moddir/do-upgrade.sh" # Run scripts generated by preupgrade-assistant after upgrade inst_hook upgrade-post 50 "$moddir/preupgrade-postupgrade.sh" # clean up after upgrade inst_hook upgrade-post 70 "$moddir/upgrade-cleanup.sh" # save the journal/logs after we're done inst_hook upgrade-post 99 "$moddir/save-journal.sh" }