- diff --git a/ptxdist/local_src/eag_usbmount/root/etc/usbmount/usbmount.conf b/ptxdist/local_src/eag_usbmount/root/etc/usbmount/usbmount.conf
- index 20e9cf5..eb48a22 100644
- --- a/ptxdist/local_src/eag_usbmount/root/etc/usbmount/usbmount.conf
- +++ b/ptxdist/local_src/eag_usbmount/root/etc/usbmount/usbmount.conf
- @@ -27,7 +27,7 @@ FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus"
- # Mount options: Options passed to the mount command with the -o flag.
- # See the warning above regarding removing "sync" from the options, as
- # it may lead to data loss.
- -MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime"
- +MOUNTOPTIONS="ro,async,noexec,nodev,noatime,nodiratime"
- # Filesystem type specific mount options: This variable contains a space
- # separated list of strings, each which the form "-fstype=TYPE,OPTIONS".
- diff --git a/ptxdist/local_src/ecu01-basicsys/sbin/eag_usbstick b/ptxdist/local_src/ecu01-basicsys/sbin/eag_usbstick
- new file mode 100755
- index 0000000..05cf238
- --- /dev/null
- +++ b/ptxdist/local_src/ecu01-basicsys/sbin/eag_usbstick
- @@ -0,0 +1,31 @@
- +#!/bin/bash
- +
- +export PATH='/sbin:/bin'
- +
- +usbfsmountpoint='/media/usb0'
- +cmd="$1"
- +
- +# use POSIX shell tracing to log trace to journalctl
- +# (observe with $ journalctl -f -a #)
- +set -o xtrace
- +
- +case "${cmd}" in
- + 'mount_writeable')
- + mount -o rw,remount "${usbfsmountpoint}"
- + exit $?
- + ;;
- + 'mount_readonly')
- + mount -o ro,remount "${usbfsmountpoint}"
- + exit $?
- + ;;
- + 'is_stick_mounted_writeable')
- + grep -q -E \
- + '[[:space:]]+'"${usbfsmountpoint}"'[[:space:]]+(fat|vfat)[[:space:]]+rw,' \
- + '/proc/self/mounts'
- + exit $?
- + ;;
- + *)
- + exit 1
- + ;;
- +esac
- +# EOF.
- diff --git a/ptxdist/local_src/ecu01-codesys/QAX/QAX.c b/ptxdist/local_src/ecu01-codesys/QAX/QAX.c
- index 79b1495..f52626a 100755
- --- a/ptxdist/local_src/ecu01-codesys/QAX/QAX.c
- +++ b/ptxdist/local_src/ecu01-codesys/QAX/QAX.c
- @@ -524,6 +524,7 @@ void CDECL CDECL_EXT usbstick_getmountpath(usbstick_getmountpath_struct *p)
- /*****************************************************/
- void CDECL CDECL_EXT usbstick_mount(usbstick_mount_struct *p)
- {
- +#ifdef OLD_BYZANTINE_USBSTICK_CODE
- /* mount -o bind /mnt/test /mnt/usbstick
- * Beide Ordner müssen existieren.
- * ändert man nun was in /mnt/usbstick ändert man auch in /mnt/test.
- @@ -556,12 +557,23 @@ void CDECL CDECL_EXT usbstick_mount(usbstick_mount_struct *p)
- /* Mountvorgang war nicht erfolgleich */
- //Log_Warning(COMPONENT_ID,"Mountvorgang fehlgeschlagen\n");
- p->USBStick_Mount = -1;
- +#else
- + int ret;
- + ret = system("/sbin/eag_usbstick mount_writeable");
- + if (ret == -1)
- + {
- + perror("/sbin/eag_usbstick mount_writeable failed.");
- + p->USBStick_Mount = -1;
- + return;
- + }
- + p->USBStick_Mount = (ret == 0)?0:-1;
- +#endif /* OLD_BYZANTINE_USBSTICK_CODE */
- } /* eofn: usbstick_mount */
- void CDECL CDECL_EXT usbstick_umount(usbstick_umount_struct *p)
- {
- -
- +#ifdef OLD_BYZANTINE_USBSTICK_CODE
- int iRet;
- //Log_Warning(COMPONENT_ID,"usbstick_umount\n");
- @@ -578,13 +590,23 @@ void CDECL CDECL_EXT usbstick_umount(usbstick_umount_struct *p)
- /* Umount erfolgreich */
- p->USBStick_Umount = 0;
- +#else
- + int ret;
- + ret = system("/sbin/eag_usbstick mount_readonly");
- + if (ret == -1)
- + {
- + perror("/sbin/eag_usbstick mount_readonly failed.");
- + p->USBStick_Umount = -1;
- + return;
- + }
- -
- + p->USBStick_Umount = (ret == 0)?0:-1;
- +#endif /* OLD_BYZANTINE_USBSTICK_CODE*/
- } /* eofn: usbstick_umount */
- void CDECL CDECL_EXT usbstick_status(usbstick_status_struct *p)
- {
- -
- +#ifdef OLD_BYZANTINE_USBSTICK_CODE
- int iRet;
- /*******************************************************************************/
- @@ -600,7 +622,18 @@ void CDECL CDECL_EXT usbstick_status(usbstick_status_struct *p)
- /* Usbstick ist bereits gemountet */
- p->USBStick_Status = 0;
- +#else
- + int ret;
- + ret = system("/sbin/eag_usbstick is_stick_mounted_writeable");
- + if (ret == -1)
- + {
- + perror("/sbin/eag_usbstick is_stick_mounted_writeable failed.");
- + p->USBStick_Status = -1;
- + return;
- + }
- + p->USBStick_Status = (ret == 0)?0:-1;
- +#endif /* OLD_BYZANTINE_USBSTICK_CODE */
- } /* eofn: usbstick_status */
- /*****************************************/
Quantron: Mount usb stick read-only by default, and only rw on demand
Posted by Anonymous on Tue 27th Aug 2019 12:34
raw | new post
view followups (newest first): Quantron+JNCG: Mount usb stick read-only by default, and only rw on demand by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.