Backup UI files before install cloud-client-ui.rpm

The backup file will locate at /usr/share/cloud/ui-backup/ with name as cloud-ui-backup-date.tar.bz2
e.g cloud-ui-backup-2011-03-02.tar.bz2
This commit is contained in:
Frank 2011-03-02 19:49:59 -08:00
parent 5cc7745d9f
commit 65cb140d45
1 changed files with 12 additions and 0 deletions

View File

@ -366,6 +366,18 @@ id %{name} > /dev/null 2>&1 || /usr/sbin/useradd -M -c "Cloud.com unprivileged u
rm -rf %{_localstatedir}/cache/%{name}
# user harcoded here, also hardcoded on wscript
%pre client-ui
if [ -d %{_datadir}/%{name}/management/webapps/client/ ]; then
pushd /tmp &>/dev/null
file=cloud-ui-backup-%(date +%%F).tar.bz2
cp -r %{_datadir}/%{name}/management/webapps/client/ .
tar cjf "$file" client/
rm -rf client/
mkdir -p /usr/share/cloud/ui-backup/
mv "$file" /usr/share/cloud/ui-backup/
popd &>/dev/null
fi
%post client
if [ "$1" == "1" ] ; then
/sbin/chkconfig --add %{name}-management > /dev/null 2>&1 || true