Browse Source

- allow /var/etc/fstab and /var/etc/autofs.* only for netfs setup

master
vanhofen 5 years ago
parent
commit
092e75a770
  1. 1
      make/ni.mk
  2. 12
      make/target-files.mk
  3. 1
      make/target-rootfs.mk
  4. 1
      make/target-tools.mk
  5. 26
      patches/busybox-mount-use-var-etc-fstab.patch
  6. 5
      skel-root/general/autofs/etc/auto.master
  7. 6
      skel-root/general/autofs/etc/auto.net
  8. 0
      skel-root/general/autofs/etc/default/autofs
  9. 8
      skel-root/general/autofs/etc/init.d/autofs
  10. 0
      skel-root/general/files-etc/fstab
  11. 2
      skel-root/general/files-etc/fstab-var
  12. 23
      skel-root/general/scripts/fstab.init
  13. 3
      skel-root/hd2/etc/fstab
  14. 3
      skel-root/hd51/etc/fstab
  15. 3
      skel-root/vuduo/etc/fstab
  16. 3
      skel-root/vuplus/etc/fstab

1
make/ni.mk

@ -84,6 +84,7 @@ ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2 hd51 vusolo4k vuduo4k vuultimo4k
endif
make autofs
make files-etc
make files-var-etc
make scripts
make init-scripts
ifeq ($(PERSONALIZE), yes)

12
make/target-files.mk

@ -5,10 +5,22 @@
files-etc: \
$(TARGET_DIR)/etc/default/rcS \
$(TARGET_DIR)/etc/fstab \
$(TARGET_DIR)/etc/inittab
$(TARGET_DIR)/etc/default/rcS:
$(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/default/rcS $(@)
$(TARGET_DIR)/etc/fstab:
$(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/fstab $(@)
$(TARGET_DIR)/etc/inittab:
$(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/inittab $(@)
# -----------------------------------------------------------------------------
files-var-etc: \
$(TARGET_DIR)/var/etc/fstab
$(TARGET_DIR)/var/etc/fstab:
$(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/fstab-var $(@)

1
make/target-rootfs.mk

@ -51,7 +51,6 @@ symbolic-links: | $(TARGET_DIR)
ifeq ($(PERSISTENT_VAR_PARTITION), yes)
$(CD) $(TARGET_DIR)/etc; \
ln -sf /var/etc/exports exports; \
ln -sf /var/etc/fstab fstab; \
ln -sf /var/etc/hostname hostname; \
ln -sf /var/etc/localtime localtime; \
ln -sf /var/etc/passwd passwd; \

1
make/target-tools.mk

@ -13,7 +13,6 @@ $(ARCHIVE)/$(BUSYBOX_SOURCE):
BUSYBOX_PATCH = busybox-fix-config-header.diff
BUSYBOX_PATCH += busybox-insmod-hack.patch
BUSYBOX_PATCH += busybox-mount-use-var-etc-fstab.patch
BUSYBOX_PATCH += busybox-fix-partition-size.patch
BUSYBOX_PATCH += busybox-mount_single_uuid.patch

26
patches/busybox-mount-use-var-etc-fstab.patch

@ -1,26 +0,0 @@
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 5fcc795..ba279f5 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -2185,6 +2185,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
llist_t *lst_o = NULL;
const char *fstabname = "/etc/fstab";
FILE *fstab;
+ FILE *fstab_var; //NI
int i, j;
int rc = EXIT_SUCCESS;
unsigned long cmdopt_flags;
@@ -2285,6 +2286,13 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
// A malicious user could overmount /usr without this.
if (ENABLE_FEATURE_MOUNT_OTHERTAB && nonroot)
fstabname = "/etc/fstab";
+ //NI use /var/etc/fstab if accessible
+ fstab_var = fopen("/var/etc/fstab", "r");
+ if (fstab_var) {
+ fstabname = "/var/etc/fstab";
+ fclose(fstab_var);
+ }
+ printf("mount: using %s\n", fstabname);
// Open either fstab or mtab
if (cmdopt_flags & MS_REMOUNT) {
// WARNING. I am not sure this matches util-linux's

5
skel-root/general/autofs/etc/auto.master

@ -1,5 +0,0 @@
# /etc/auto.master: automounter map definitions
#
# <mount-point> [map-type[,format]:]<map> [options]
#
/mnt/autofs /etc/auto.net

6
skel-root/general/autofs/etc/auto.net

@ -1,6 +0,0 @@
# /etc/auto.net: dynamic file system information.
#
# Every single mount point below will be available in /mnt/autofs during start
# or possibly even later if you request it.
#
# <mount point> -fstype=<type>,<options> <file system>

0
skel-root/general/autofs/etc/autofs → skel-root/general/autofs/etc/default/autofs

8
skel-root/general/autofs/etc/init.d/autofs

@ -15,7 +15,7 @@ if ! grep -q autofs /proc/filesystems; then # the kernel does not know it
if [ -e /lib/modules/$(uname_r)/autofs4.ko ]; then
MODULE=/lib/modules/$(uname_r)/autofs4.ko # hd1
else
MODULE=/lib/modules/$(uname_r)/kernel/fs/autofs4/autofs4.ko # hd2
MODULE=/lib/modules/$(uname_r)/kernel/fs/autofs4/autofs4.ko
fi
if ! insmod $MODULE > /dev/null 2>&1; then # module loading failed
@ -27,10 +27,6 @@ DEVICE="autofs"
# the MAPFILE is the "configfile" for automount
MAPFILE=/var/etc/auto.master
if [ ! -e $MAPFILE ]; then
# fallback to /etc/auto.master
MAPFILE=/etc/auto.master
fi
# allow stopping the daemon even without a mapfile
if [ ! -e $MAPFILE -a "x$1" = "xstart" ]; then
@ -56,7 +52,7 @@ PIDFILE=/var/run/automount.pid
#
# load customized configuation settings
#
CUSTOMCONF=/etc/autofs
CUSTOMCONF=/etc/default/autofs
if [ -e $CUSTOMCONF ]; then
. $CUSTOMCONF
fi

0
skel-root/hd1/etc/fstab → skel-root/general/files-etc/fstab

2
skel-root/hd2/var/etc/fstab → skel-root/general/files-etc/fstab-var

@ -1,3 +1,3 @@
# /var/etc/fstab: static file system information.
# /var/etc/fstab: static net file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

23
skel-root/general/scripts/fstab.init

@ -6,21 +6,24 @@ SRVFLAG=/var/etc/.srv
MTAB=/etc/mtab
FSTAB=/etc/fstab
if [ -e /var/etc/fstab ]; then
FSTAB=/var/etc/fstab
fi
FSTAB_VAR=/var/etc/fstab
is_mount()
{
RET=1
test -f $MTAB || return $RET
while read _DEV _MTPT _FSTYPE _OPTS _REST
while read DEV MTPT FSTYPE OPTS REST
do
case "$_FSTYPE" in
"tmpfs") continue ;;
case "$FSTYPE" in
"tmpfs")
continue
;;
esac
case "$1" in
"$_DEV"|"$_MTPT") RET=0; break ;;
"$DEV"|"$MTPT")
RET=0
break
;;
esac
done < $MTAB
return $RET
@ -71,8 +74,8 @@ mount_local()
mount_netfs()
{
SHOWINFO "mount all netfs stuff from $FSTAB"
test -f $FSTAB || return
SHOWINFO "mount all netfs stuff from $FSTAB_VAR"
test -f $FSTAB_VAR || return
rm -f $SRVFLAG
while read DEV MTPT FSTYPE OPTS REST
do
@ -122,7 +125,7 @@ mount_netfs()
continue
;;
esac
done < $FSTAB
done < $FSTAB_VAR
}
umount_netfs()

3
skel-root/hd2/etc/fstab

@ -1,3 +0,0 @@
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

3
skel-root/hd51/etc/fstab

@ -1,3 +0,0 @@
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

3
skel-root/vuduo/etc/fstab

@ -1,3 +0,0 @@
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

3
skel-root/vuplus/etc/fstab

@ -1,3 +0,0 @@
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
Loading…
Cancel
Save