postplug/postplug.d/12loadconf
2011-04-27 19:57:03 +02:00

53 lines
1.5 KiB
Bash

#!/bin/bash
#
# loadconf - postplug plugin: restore the QiLinux Live system/user configuration
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
if [ $UID != 0 ]; then
echo "$0: must be superuser." >&2
exit 1
fi
# FIXME: add translation
me="loadconf"
. /etc/postplug/postplug.defs
#qitarget="$(LANG=C cat /etc/qilinux-release |
# sed "s,[ ]*release.*,,;s, ,-,")"
#qiver="$(LANG=C cat /etc/qilinux-release |
# sed "s,.*release[ ]*\([^ ]*\)[ ]*for.*,\1,")"
#qiconf="$qitarget-$qiver-saveconf.tar.bz2"
qiconf="QiLinux-live-saveconf.tar.bz2"
grep "^/" /etc/fstab | \
while read dev mountpoint skip; do
case "$mountpoint" in
/mnt/cdrom*|swap) ;;
*) mount | grep "$dev" &>/dev/null
let "res = $?" # 0: mounted; 1: not mounted
[ "$res" = 1 ] && mount $mountpoint 2>>$logfile
if [ -e $mountpoint/$qiconf ]; then
# temporary disable bootsplash
[ -w /proc/splash ] && echo "verbose" > /proc/splash
$DIALOG --clear --colors \
--backtitle "\
$dialog_backtitle -- "$"Restore QiLinux configuration" \
--title $" RESTORE QILINUX CONFIGURATION " \
--yesno "
"$"Do you want to restore the configuration saved on ""
""\Z4$dev\Zn ?" 8 56
if [ $? -eq 0 ]; then
/usr/sbin/livecd-restore $mountpoint >>$logfile 2>&1
[ "$res" = 1 ] && umount $mountpoint 2>>$logfile
break
fi
fi
[ "$res" = 1 ] && umount $mountpoint 2>>$logfile ;;
esac
done