]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/pakfire/lib/functions.sh
Pakfire: call "sync" in function.sh after having extracted archives
[people/pmueller/ipfire-2.x.git] / src / pakfire / lib / functions.sh
index 9c8bf53e851509c3de6c81e9718ae6ab9aeeb325..67986e20e113a935959b394a95d0e4744b045aa7 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2012  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2021  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 xavf /opt/pakfire/tmp/files --no-overwrite-dir -p --numeric-owner -C /
+       tar -xavf /opt/pakfire/tmp/files* "${TAR_OPTIONS[@]}" -C /
+       sync
        echo "...Finished."
 }
 
 extract_backup_includes() {
        echo "Extracting backup includes..."
-       tar xavf /opt/pakfire/tmp/files --no-overwrite-dir -p --numeric-owner -C / \
+       tar xavf /opt/pakfire/tmp/files* "${TAR_OPTIONS[@]}" -C / \
                var/ipfire/backup/addons/includes
+       sync
        echo "...Finished."
 }
 
@@ -86,7 +98,7 @@ start_service() {
                esac
        done
 
-       if [ -e "/etc/init.d/${1}" ]; then
+       if [ -f "/etc/init.d/${1}" ]; then
            if [ -n "${BACKGROUND}" ]; then
                                (sleep ${DELAY} && /etc/init.d/${1} start) &
                        else
@@ -96,7 +108,7 @@ start_service() {
 }
 
 stop_service() {
-       if [ -e "/etc/init.d/${1}" ]; then
+       if [ -f "/etc/init.d/${1}" ]; then
                /etc/init.d/${1} stop
        fi
 }