From: Ramesh GK <ram...@ho...> - 2021-12-12 21:13:36
|
Hi, A while back I reached out of using AstLinux as a Home Gateway Appliance. I am working on the same and observed a weird issue. I migrated the entire build system to buildroot-2017.02.11 and the packages merged between (buildroot and AstLinux) and fixed all (mostly) issues. Happy to share the code base but it is still in beta with a working firmware image as I have not tested the Asterisk components. When I startup the firmware image and open any file in /mnt/asturo (/etc or /stat) that does not have a link to /tmp, it creates a duplicate file in /mnt/asturw. This should not pose a problem if both files are same however when the firmware image is updated. the file in /mnt/asturo is newer than the file in /mnt/asturw which became stale as it was kept back with the assumption that the file contents have changed but it was in fact the file attributes that got changed. I could not able to find a cleaner approach and thought of checking if there is any clean way of making sure that the files do not become stale. for now I put in a temporary fix that seem to be working which checks on startup and shutdown if the files between /mnt/asturo and /mnt/asturw are same and if yes then remove the files from /mnt/asturw so they do not become stale. /etc/init.d/misc cleanup_asturw() { local dir1=/mnt/asturo local dir2=/mnt/asturw for newfile in $(find $dir2 -type f); do if [ -e "${newfile/${dir2}/${dir1}}" ]; then file=${newfile/${dir2}/${dir1}} if cmp -s "$file" "$newfile" ; then # echo "Cleaning up -> $newfile" rm -f $newfile fi fi done } mhtgw ~ # stat /etc/common_functions.sh File: /etc/common_functions.sh Size: 4038 Blocks: 8 IO Block: 1024 regular file Device: 12h/18d Inode: 34824 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-12-12 04:51:16.000000000 Modify: 2021-12-12 04:51:16.000000000 Change: 2021-12-12 20:52:40.000000000 mhtgw ~ # stat /mnt/asturo/etc/common_functions.sh File: /mnt/asturo/etc/common_functions.sh Size: 4038 Blocks: 8 IO Block: 4096 regular file Device: ch/12d Inode: 3360 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-12-12 04:51:16.000000000 Modify: 2021-12-12 04:51:16.000000000 Change: 2021-12-12 20:47:12.000000000 mhtgw ~ # stat /mnt/asturw/etc/common_functions.sh File: /mnt/asturw/etc/common_functions.sh Size: 4038 Blocks: 8 IO Block: 1024 regular file Device: 802h/2050d Inode: 34824 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-12-12 04:51:16.000000000 Modify: 2021-12-12 04:51:16.000000000 Change: 2021-12-12 20:52:40.000000000 Any thoughts or ideas are greatly appreciated Thanks Ramesh GK |