From 36a8a2d278f02e45c5eff86496fb95c73b47b2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sat, 7 May 2016 03:17:46 +0200 Subject: [PATCH] [enh] Try to remount directory as read-only in ynh_backup (wip #298) --- data/helpers.d/filesystem | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/helpers.d/filesystem b/data/helpers.d/filesystem index 49024981b..db12fb761 100644 --- a/data/helpers.d/filesystem +++ b/data/helpers.d/filesystem @@ -38,6 +38,10 @@ ynh_backup() { eval $SUDO_CMD mkdir -p "${DESTPATH}" if sudo mount --rbind "${SRCPATH}" "${DESTPATH}"; then + # try to remount destination directory as read-only + sudo mount -o remount,ro "${DESTPATH}" \ + || sudo mount -o remount,ro,bind "${SRCPATH}" "${DESTPATH}" \ + || true return 0 else CAN_BIND=0