max-boehm / qnap-utils

Utilities to unpack QNAP firmware images and QPKG files
60 stars 23 forks source link

Avoid hiding files in /mnt when extracting images #5

Open ktetzlaff opened 1 year ago

ktetzlaff commented 1 year ago

When running extract_qnap_fw.sh on a QNAP NAS, mounting something on /mnt hides already existing mounts within /mnt. A lot of file in /etc are actually just symlinks to /mnt/config, and /etc/passwd is one of them. So when mounting a directory on /mnt results in loosing access to all account information. I.e. any subsequent attempt to use sudo (or login to the system) fails.

This change uses temporary directories (created using mktemp) to mount images in order to avoid the issue.