If it's in fstab, let mount work everything out instead of us.
This commit is contained in:
parent
675d0a94c7
commit
46af0c7ddb
@ -31,7 +31,6 @@ single_user() {
|
|||||||
mount_svcdir() {
|
mount_svcdir() {
|
||||||
local fs= fsopts="-o rw,noexec,nodev,nosuid" devdir="none" devtmp="none" x=
|
local fs= fsopts="-o rw,noexec,nodev,nosuid" devdir="none" devtmp="none" x=
|
||||||
local svcsize=${svcsize:-1024}
|
local svcsize=${svcsize:-1024}
|
||||||
local mntcmd=$(fstabinfo --mountcmd "${RC_SVCDIR}")
|
|
||||||
|
|
||||||
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
|
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
|
||||||
fs="tmpfs"
|
fs="tmpfs"
|
||||||
@ -56,11 +55,6 @@ mount_svcdir() {
|
|||||||
single_user
|
single_user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we have no entry in fstab for $svcdir, provide our own
|
|
||||||
if [ -z "${mntcmd}" ] ; then
|
|
||||||
mntcmd="-t ${fs} ${fsopts} ${devdir} ${RC_SVCDIR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local dotmp=false
|
local dotmp=false
|
||||||
if [ -e "${RC_SVCDIR}"/deptree ]; then
|
if [ -e "${RC_SVCDIR}"/deptree ]; then
|
||||||
dotmp=true
|
dotmp=true
|
||||||
@ -68,7 +62,14 @@ mount_svcdir() {
|
|||||||
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
||||||
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
||||||
fi
|
fi
|
||||||
eval try mount -n ${mntcmd}
|
|
||||||
|
# If we have no entry in fstab for $svcdir, provide our own
|
||||||
|
if fstabinfo --quiet "${RC_SVCDIR}"; then
|
||||||
|
try mount -n "${RC_SVCDIR}"
|
||||||
|
else
|
||||||
|
try mount -n -t "${fs}" ${fsopts} "${devdir}" "${RC_SVCDIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
if ${dotmp}; then
|
if ${dotmp}; then
|
||||||
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
||||||
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
||||||
@ -121,8 +122,11 @@ if ${mountproc} ; then
|
|||||||
procfs="proc"
|
procfs="proc"
|
||||||
[ "${RC_UNAME}" = "GNU/kFreeBSD" ] && proc="linprocfs"
|
[ "${RC_UNAME}" = "GNU/kFreeBSD" ] && proc="linprocfs"
|
||||||
ebegin "Mounting ${procfs} at /proc"
|
ebegin "Mounting ${procfs} at /proc"
|
||||||
mntcmd="$(fstabinfo --mountcmd /proc)"
|
if fstabinfo --quiet /proc; then
|
||||||
eval try mount -n ${mntcmd:--t ${procfs} -o noexec,nosuid,nodev proc /proc}
|
try mount -n /proc
|
||||||
|
else
|
||||||
|
try mount -n -t "${procfs}" -o noexec,nosuid,nodev proc /proc
|
||||||
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
unset mountproc
|
unset mountproc
|
||||||
@ -142,8 +146,11 @@ if [ "${RC_UNAME}" != "GNU/kFreeBSD" -a "${RC_SYS}" != "VPS" -a "${K26}" = "0" ]
|
|||||||
if [ -d /sys ]; then
|
if [ -d /sys ]; then
|
||||||
if ! mountinfo --quiet /sys; then
|
if ! mountinfo --quiet /sys; then
|
||||||
ebegin "Mounting sysfs at /sys"
|
ebegin "Mounting sysfs at /sys"
|
||||||
mntcmd="$(fstabinfo --mountcmd /sys)"
|
if fstabinfo --quiet /sys; then
|
||||||
eval try mount -n ${mntcmd:--t sysfs -o noexec,nosuid,nodev sysfs /sys}
|
try mount -n /sys
|
||||||
|
else
|
||||||
|
try mount -n -t sysfs -o noexec,nosuid,nodev sysfs /sys
|
||||||
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -211,8 +218,11 @@ if grep -Eq "[[:space:]]+devpts$" /proc/filesystems && \
|
|||||||
|
|
||||||
if [ -d /dev/pts ]; then
|
if [ -d /dev/pts ]; then
|
||||||
ebegin "Mounting devpts at /dev/pts"
|
ebegin "Mounting devpts at /dev/pts"
|
||||||
mntcmd="$(fstabinfo --mountcmd /dev/pts)"
|
if fstabinfo --quiet /dev/pts; then
|
||||||
eval try mount -n ${mntcmd:--t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts}
|
try mount -n /dev/pts
|
||||||
|
else
|
||||||
|
try mount -n -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
|
||||||
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -67,7 +67,6 @@ static struct mntent *getmntfile (const char *file)
|
|||||||
#include "_usage.h"
|
#include "_usage.h"
|
||||||
#define getoptstring "mop:t:" getoptstring_COMMON
|
#define getoptstring "mop:t:" getoptstring_COMMON
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
{ "mountcmd", 0, NULL, 'm'},
|
|
||||||
{ "options", 0, NULL, 'o'},
|
{ "options", 0, NULL, 'o'},
|
||||||
{ "passno", 1, NULL, 'p'},
|
{ "passno", 1, NULL, 'p'},
|
||||||
{ "fstype", 1, NULL, 't'},
|
{ "fstype", 1, NULL, 't'},
|
||||||
@ -84,7 +83,6 @@ static const char * const longopts_help[] = {
|
|||||||
#include "_usage.c"
|
#include "_usage.c"
|
||||||
|
|
||||||
#define OUTPUT_FILE (1 << 1)
|
#define OUTPUT_FILE (1 << 1)
|
||||||
#define OUTPUT_MOUNTCMD (1 << 2)
|
|
||||||
#define OUTPUT_OPTIONS (1 << 3)
|
#define OUTPUT_OPTIONS (1 << 3)
|
||||||
#define OUTPUT_PASSNO (1 << 4)
|
#define OUTPUT_PASSNO (1 << 4)
|
||||||
|
|
||||||
@ -109,10 +107,6 @@ int fstabinfo (int argc, char **argv)
|
|||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'm':
|
|
||||||
output = OUTPUT_MOUNTCMD;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
output = OUTPUT_OPTIONS;
|
output = OUTPUT_OPTIONS;
|
||||||
break;
|
break;
|
||||||
@ -185,11 +179,6 @@ int fstabinfo (int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (output) {
|
switch (output) {
|
||||||
case OUTPUT_MOUNTCMD:
|
|
||||||
printf ("-o %s -t %s '%s' '%s'\n", ENT_OPTS (ent),
|
|
||||||
ENT_TYPE (ent), ENT_DEVICE (ent), ENT_FILE (ent));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OUTPUT_OPTIONS:
|
case OUTPUT_OPTIONS:
|
||||||
printf ("%s\n", ENT_OPTS (ent));
|
printf ("%s\n", ENT_OPTS (ent));
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user