owfs: add sysv init scripts
PATCH 1/1 owfs: add sysv init scripts
owserver is started unconditionally, but it needs the device(s) to be specified at startup. Therefore a check for non-empty OWSERVER_ARGS is added to the owserver start script.
owfs is started only if is built. It will connect to the owserver. It will try to load the fuse module; if fuse is built-in or already loaded, modprobe -q will fail silently.
Users who want a setup without owserver need to remove the owserver init script post-build and need to give appropriate defaults to owfs.
--- package/owfs/S25owserver | 31 +++++++++++++++++++++++++++++++ package/owfs/S30owfs | 32 ++++++++++++++++++++++++++++++++ package/owfs/owfs.mk | 10 ++++++++++ 3 files changed, 73 insertions(+) create mode 100755 package/owfs/S25owserver create mode 100755 package/owfs/S30owfs
package/owfs/S25owserver new file +31 -0
@@ -0,0 +1,31 @@ +NAME="owserver" +DAEMON="/usr/bin/${NAME}" +PID_F="/run/${NAME}.pid" + +OWSERVER_ARGS= +[ -r /etc/default/${NAME} ] && . /etc/default/${NAME} + +case "$1" in +start) + printf "Starting ${NAME}: " + if [ -z "${OWSERVER_ARGS}" ]; then + echo "OWSERVER_ARGS must be set in defaults file" 1>&2 + exit 1 + fi + start-stop-daemon -S -x ${DAEMON} -- \ + --pid_file ${PID_F} ${OWSERVER_ARGS} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +stop) + printf "Stopping ${NAME}: " + start-stop-daemon -K -p ${PID_F} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +restart|reload) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac
package/owfs/S30owfs new file +32 -0
@@ -0,0 +1,32 @@ +NAME="owfs" +DAEMON="/usr/bin/${NAME}" +PID_F="/run/${NAME}.pid" +MOUNTPOINT="/dev/1wire" +SERVER="localhost:4304" + +[ -r /etc/default/${NAME} ] && . /etc/default/${NAME} + +case "$1" in +start) + printf "Starting ${NAME}: " + # Fuse may be in a module, so try to load it + modprobe -q fuse && printf "[fuse] " + mkdir -p ${MOUNTPOINT} + start-stop-daemon -S -x ${DAEMON} -- \ + --pid_file ${PID_F} -s ${SERVER} -m ${MOUNTPOINT} \ + ${OWFS_ARGS} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +stop) + printf "Stopping ${NAME}: " + start-stop-daemon -K -p ${PID_F} + [ $? -eq 0 ] && echo "OK" || echo "FAIL" + ;; +restart|reload) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac
package/owfs/owfs.mk +10 -0
@@ -23,6 +23,10 @@ OWFS_CONF_OPTS += \ --enable-owfs \ --with-fuseinclude=$(STAGING_DIR)/usr/include \ --with-fuselib=$(STAGING_DIR)/usr/lib +define OWFS_INSTALL_FUSE_INIT_SYSV + $(INSTALL) -D -m 0755 $(OWFS_PKGDIR)S30owfs \ + $(TARGET_DIR)/etc/init.d/S30owfs +endef else OWFS_CONF_OPTS += --disable-owfs endif
@@ -70,4 +74,10 @@ ifeq ($(BR2_STATIC_LIBS),y) OWFS_CONF_OPTS += --disable-zero endif +define OWFS_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(OWFS_PKGDIR)S25owserver \ + $(TARGET_DIR)/etc/init.d/S25owserver + $(OWFS_INSTALL_FUSE_INIT_SYSV) +endef + $(eval $(autotools-package))
Signature · 1 line
2.8.0.rc3
PATCH 1/1 owfs: add sysv init scripts
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:
owserver is started unconditionally, but it needs the device(s) to be specified at startup. Therefore a check for non-empty
OWSERVER_ARGSis added to the owserver start script.
Quoted 8 lines
owfs is started only if is built. It will connect to the owserver. It will try to load the fuse module; if fuse is built-in or already loaded, modprobe -q will fail silently.
Users who want a setup without owserver need to remove the owserver init script post-build and need to give appropriate defaults to owfs.
Looks good, except:
package/owfs/S30owfs line 5
Quoted 11 lines
package/owfs/S30owfs new file +5
-0@@ -0,0 +1,32 @@ +NAME="owfs" +DAEMON="/usr/bin/${NAME}" +PID_F="/run/${NAME}.pid" +MOUNTPOINT="/dev/1wire" +SERVER="localhost:4304"
I've never used owfs, but /dev/1wire sounds like an odd mount point to me. I would have expected something under /mnt?
Googling around, I see the manual page suggests /mnt/1wire:
http://owfs.org/index.php?page=owfs
You will need to create the mount point during build time though, as /mnt might not be writable.
The point of sourcing /etc/default/owfs is so the user can override the defaults. How about sticking the MOUNTPOINT / SERVER into a OWFS_ARGS or at least prefixing the variables with OWFS?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 owfs: add sysv init scripts
Quoted 17 lines · Peter Korsgaard
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:
owserver is started unconditionally, but it needs the device(s) to be specified at startup. Therefore a check for non-empty
OWSERVER_ARGSis added to the owserver start script.Quoted 8 lines
owfs is started only if is built. It will connect to the owserver. It will try to load the fuse module; if fuse is built-in or already loaded, modprobe -q will fail silently.
Users who want a setup without owserver need to remove the owserver init script post-build and need to give appropriate defaults to owfs.
Looks good, except:
Quoted 14 lines
package/owfs/S30owfs line 5
Quoted 11 lines
package/owfs/S30owfs new file +5
-0@@ -0,0 +1,32 @@ +NAME="owfs" +DAEMON="/usr/bin/${NAME}" +PID_F="/run/${NAME}.pid" +MOUNTPOINT="/dev/1wire" +SERVER="localhost:4304"I've never used owfs, but
/dev/1wiresounds like an odd mount point to me. I would have expected something under /mnt?
/dev/1wire is what is used by the bundled debian init scripts. I didn't use
the bundled init scripts because they are slightly more complicated than what we need and I wanted to add some features, like loading the fuse module.
/mnt is annoying, because some scripts will (temporarily) mount something on
/mnt (without subdir), thus hiding anything else mounted there. For example, many of our board readme's say to mount /dev/mmcblk0p1 /mnt as part of creating the SD card.
In addition, owfs exports access to devices, so /dev seems like an appropriate
place. /mnt, to me, is for mounting actual storage filesystems.
I've also considered /sys/fs which already gets a couple of pseudofilesystems
mounted on it, and the owfs nodes are a bit similar to sysfs nodes. However, /sys/fs really is for metadata of filesystems, not for adding actual devices.
The contents of owfs really should be in /sys/devices. However, the
organisation of the owfs tree is not really that similar to the sysfs tree, so it's not a great fit either.
So, taking all of that into account, I chose to stick to the /dev/1wire that
is also used by the bundled debian init scripts.
Quoted 7 lines
Googling around, I see the manual page suggests
/mnt/1wire:http://owfs.org/index.php?page=owfs
You will need to create the mount point during build time though, as /mnt might not be writable.
Oh yeah, another reason to put it on /dev or /sys.
Quoted 4 lines
The point of sourcing
/etc/default/owfsis so the user can override the defaults. How about sticking the MOUNTPOINT / SERVER into aOWFS_ARGSor at least prefixing the variables with OWFS?
Yes, that's a good idea. I'm on it.
Regards,
Arnout
Quoted 1 line
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 owfs: add sysv init scripts
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Hi,
Quoted 8 lines
Quoted 2 lines
I've never used owfs, but
/dev/1wiresounds like an odd mount point to me. I would have expected something under /mnt?
/dev/1wireis what is used by the bundled debian init scripts. I
didn't use the bundled init scripts because they are slightly more complicated than what we need and I wanted to add some features, like loading the fuse module.
Quoted 4 lines
/mnt is annoying, because some scripts will (temporarily) mount
something on /mnt (without subdir), thus hiding anything else mounted there. For example, many of our board readme's say to mount/dev/mmcblk0p1/mnt as part of creating the SD card.
Ok, /dev/1wire is ok with me.
Quoted 8 lines
Quoted 6 lines
Googling around, I see the manual page suggests
/mnt/1wire:http://owfs.org/index.php?page=owfs
You will need to create the mount point during build time though, as /mnt might not be writable.
Oh yeah, another reason to put it on /dev or /sys.
Do keep in mind that we still support BR2_ROOTFS_DEVICE_CREATION_STATIC, so you need to create it at build time AND mkdir -p it in the init script.
Quoted 5 lines
Quoted 3 lines
The point of sourcing
/etc/default/owfsis so the user can override the defaults. How about sticking the MOUNTPOINT / SERVER into aOWFS_ARGSor at least prefixing the variables with OWFS?Yes, that's a good idea. I'm on it.
Great, thanks!
Signature · 2 lines
Venlig hilsen, Peter Korsgaard