]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/pakfire/lib/functions.sh
pakfire: Do not delay directory restore
[people/pmueller/ipfire-2.x.git] / src / pakfire / lib / functions.sh
index ccd58dbda23b816273b4dec69bd387048e8f32cc..f784cf79267566daf8244c6a2e85e394d53aa382 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2007-2012  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
 . /etc/sysconfig/rc
 . $rc_functions
 
+TAR_OPTIONS=(
+       --acls
+       --xattrs
+       --xattrs-include='*'
+       --no-overwrite-dir
+       --no-delay-directory-restore
+       --preserve-permissions
+       --numeric-owner
+)
+
 extract_files() {
        echo "Extracting files..."
-       tar xvf /opt/pakfire/tmp/files --preserve --numeric-owner -C /
+       tar -xavf /opt/pakfire/tmp/files* "${TAR_OPTIONS[@]}" -C /
+       echo "...Finished."
+}
+
+extract_backup_includes() {
+       echo "Extracting backup includes..."
+       tar xavf /opt/pakfire/tmp/files* "${TAR_OPTIONS[@]}" -C / \
+               var/ipfire/backup/addons/includes
        echo "...Finished."
 }
 
 remove_files() {
        echo "Removing files..."
-       for i in $(cat /opt/pakfire/tmp/ROOTFILES); do
-               rm -rfv ${i}
+       for i in $(cat /opt/pakfire/db/rootfiles/${NAME}); do
+           rm -rfv /${i}
        done
        echo "...Finished."
 }
@@ -75,17 +92,28 @@ start_service() {
                                ;;
                        *)
                                break
-                               ;;                      
+                               ;;
                esac
        done
-               
-       if [ -e "/etc/init.d/${1}" ]; then
-        (sleep ${DELAY} && /etc/init.d/${1} start) ${BACKGROUND}
+
+       if [ -f "/etc/init.d/${1}" ]; then
+           if [ -n "${BACKGROUND}" ]; then
+                               (sleep ${DELAY} && /etc/init.d/${1} start) &
+                       else
+                               sleep ${DELAY} && /etc/init.d/${1} start
+                       fi
        fi
 }
 
 stop_service() {
-       if [ -e "/etc/init.d/${1}" ]; then
+       if [ -f "/etc/init.d/${1}" ]; then
                /etc/init.d/${1} stop
        fi
 }
+
+rebuild_langcache() {
+       echo "Rebuilding language cache..."
+       perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
+       echo "...Finished."
+}
+