summaryrefslogtreecommitdiffstats
path: root/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript')
-rwxr-xr-xremote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript13
1 files changed, 13 insertions, 0 deletions
diff --git a/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript b/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
index 3b5d7f92..e3a45ecf 100755
--- a/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
+++ b/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
@@ -38,6 +38,14 @@ umount_samba_shares() {
done
}
+backup_users(){
+ # create patch files to backup the users created by the openslx, so we can restore then in the next session.
+ for file in passwd shadow group; do
+ diff -u /home/openslx/.$file.backup /etc/$file > /home/openslx/.$file.patch
+ done
+ echo "Patch of /etc/{passwd,shadow,group} generated at /home/openslx/.{passwd,shadow,group}.patch"
+}
+
# Searching for nfs-shares in mtab:
if [ $(echo /etc/mtab | cut -d " " -f 3 | grep -q nfs) ]; then
umount_nfs_shares
@@ -47,4 +55,9 @@ fi
if [ $(echo /etc/mtab|cut -d " " -f 3 | grep -q cifs) ]; then
umount_samba_shares
fi
+
+if [ -d /home/openslx ]; then
+ backup_users
+fi
+
exit $ERRORLEVEL