Skip to content
Snippets Groups Projects
Commit 8fba9b3c authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

adapt to execline,s6 and 66 new release

parent cea59538
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ Build Instructions ...@@ -4,7 +4,7 @@ Build Instructions
## Requirements ## Requirements
- GNU make version 3.81 or later - GNU make version 3.81 or later
This software will install on any operating system that implements POSIX.1-2008, available at [opengroup](http://pubs.opengroup.org/onlinepubs/9699919799/). This software will install on any operating system that implements POSIX.1-2008, available at [opengroup](http://pubs.opengroup.org/onlinepubs/9699919799/).
## Standard usage ## Standard usage
...@@ -16,10 +16,10 @@ This software will install on any operating system that implements POSIX.1-2008, ...@@ -16,10 +16,10 @@ This software will install on any operating system that implements POSIX.1-2008,
You can customize paths via flags given to configure. See `./configure --help` for a list of all available configure options. You can customize paths via flags given to configure. See `./configure --help` for a list of all available configure options.
## Runtime dependencies ## Runtime dependencies
- execline version 2.6.0.2 or later: http://skarnet.org/software/execline/ - execline version 2.7.0.0 or later: http://skarnet.org/software/execline/
- s6 version 2.9.1.0 or later: http://skarnet.org/software/s6/ - s6 version 2.10.0.0 or later: http://skarnet.org/software/s6/
- 66 version 0.5.1.0 or later https://framagit.org/Obarun/66/ - 66 version 0.6.0.0 or later https://framagit.org/Obarun/66/
- 66-tools version 0.0.6.2 or later https://framagit.org/Obarun/66-tools/ - 66-tools version 0.0.7.0 or later https://framagit.org/Obarun/66-tools/
- optional dependencies: - optional dependencies:
* dbus-66serv version 0.2.0 or later https://framagit.org/pkg/observice/dbus-66serv * dbus-66serv version 0.2.0 or later https://framagit.org/pkg/observice/dbus-66serv
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
--- ---
# In 0.3.0
- Adapt to execline 2.7.0.0
- Adapt to 66 0.6.0.0
---
# In 0.2.1 # In 0.2.1
- Convenient release to udpate dependencies: - Convenient release to udpate dependencies:
- 66 v0.5.1.0 - 66 v0.5.1.0
- 66-tools v0.0.6.2 - 66-tools v0.0.6.2
- optional dependency: - optional dependency:
- dbus-66serv 0.2.0 for environment configuration - dbus-66serv 0.2.0 for environment configuration
--- ---
...@@ -19,5 +27,5 @@ ...@@ -19,5 +27,5 @@
--- ---
# In 0.1.0 # In 0.1.0
- first commit - first commit
...@@ -15,7 +15,7 @@ owner="${1}" ...@@ -15,7 +15,7 @@ owner="${1}"
home_env=$(homeof "${owner}" 2>/dev/null) home_env=$(homeof "${owner}" 2>/dev/null)
if [ -z "${home_env}" ]; then if [ -z "${home_env}" ]; then
die "invalid user: ${owner}" die "invalid user: ${owner}"
fi fi
home_env="${home_env}/${MOD_SERVICE_USERCONFDIR}svscan@${owner}" home_env="${home_env}/${MOD_SERVICE_USERCONFDIR}svscan@${owner}"
...@@ -24,73 +24,73 @@ service_dir="${MOD_MODULE_DIR}/service@" ...@@ -24,73 +24,73 @@ service_dir="${MOD_MODULE_DIR}/service@"
svscan="${service_dir}/svscan@" svscan="${service_dir}/svscan@"
check_empty_var(){ check_empty_var(){
name="${1}" var_value="${2}" name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}" die invalid value for variable: "${name}"
fi fi
} }
disable() { disable() {
name=${1} name=${1}
66-yeller %rdisable%n service: "${name}" 66-yeller %rdisable%n service: "${name}"
sed -i "s:${name}:#${name}:g" "${svscan}" || die "unable to sed ${service_dir}/scandir@" sed -i "s:${name}:#${name}:g" "${svscan}" || die "unable to sed ${service_dir}/scandir@"
} }
enable() { enable() {
name=${1} name=${1}
66-yeller %benable%n service: "${name}" 66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}" touch "${MOD_MODULE_DIR}/service/${name}"
} }
absolute_path(){ absolute_path(){
name="${1}" var="${2}" name="${1}" var="${2}"
if [ "$(66-yeller -i "${var}" | cut -c 1)" != "/" ]; then if [ "$(66-yeller -i "${var}" | cut -c 1)" != "/" ]; then
die "${name}" must be an absolute path die "${name}" must be an absolute path
fi fi
} }
if execl-toc -X -V LIVE_DIRECTORY; then if execl-toc -X -V LIVE_DIRECTORY; then
check_empty_var "LIVE_DIRECTORY" "${LIVE_DIRECTORY}" check_empty_var "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
absolute_path "LIVE_DIRECTORY" "${LIVE_DIRECTORY}" absolute_path "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
66-yeller set live directory to: %b"${LIVE_DIRECTORY}"%n 66-yeller set live directory to: %b"${LIVE_DIRECTORY}"%n
sed -i "s:@LIVE_DIR@:-l ${LIVE_DIRECTORY}:" "${svscan}" || die "unable to set the live directory to use" sed -i "s:@LIVE_DIR@:-l ${LIVE_DIRECTORY}:" "${svscan}" || die "unable to set the live directory to use"
else else
66-yeller set live directory to: %b${MOD_LIVE}%n 66-yeller set live directory to: %b${MOD_LIVE}%n
sed -i "s:@LIVE_DIR@:-l ${MOD_LIVE}:" "${svscan}" || die "unable to set the live directory to use" sed -i "s:@LIVE_DIR@:-l ${MOD_LIVE}:" "${svscan}" || die "unable to set the live directory to use"
fi fi
if [ "${USE_ENVIRONMENT}" = yes ]; then if [ "${USE_ENVIRONMENT}" = yes ]; then
enable "setenv@${owner}" enable "setenv@${owner}"
sed -i "s:@USE_ENVIRONMENT@:-e ${home_env}:" "${svscan}" || die "unable to set environment directory to use" sed -i "s:@USE_ENVIRONMENT@:-e ${home_env}:" "${svscan}" || die "unable to set environment directory to use"
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" "${service_dir}/setenv@" || die "unable to set environment directory to use" sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" "${service_dir}/setenv@" || die "unable to set environment directory to use"
else else
disable "setenv@@I" disable "setenv@@I"
sed -i "s:@USE_ENVIRONMENT@::" "${svscan}" || die "unable to set environment directory to use" sed -i "s:@USE_ENVIRONMENT@::" "${svscan}" || die "unable to set environment directory to use"
fi fi
if [ "${LOGGER}" != "yes" ]; then if [ "${LOGGER}" != "yes" ]; then
66-yeller %rdisable%n logger options 66-yeller %rdisable%n logger options
sed -i "s:@options:#@options:" "${svscan}" || die "unable to disable log options" sed -i "s:#@options:@options:" "${svscan}" || die "unable to disable log options"
else else
66-yeller %benable%n logger options 66-yeller %benable%n logger options
fi fi
if [ "${NOTIFY}" != "yes" ]; then if [ "${NOTIFY}" != "yes" ]; then
66-yeller %rdisable%n notification 66-yeller %rdisable%n notification
sed -i "s:@NOTIFY@::" "${svscan}" || die "unable to disable notification" sed -i "s:@NOTIFY@::" "${svscan}" || die "unable to disable notification"
sed -i "s:@notify:#@notify:" "${svscan}" || die "unable to disable notification" sed -i "s:@notify:#@notify:" "${svscan}" || die "unable to disable notification"
else else
66-yeller %benable%n notification 66-yeller %benable%n notification
sed -i "s:@NOTIFY@:-d3:" "${svscan}" || die "unable to enable notification" sed -i "s:@NOTIFY@:-d3:" "${svscan}" || die "unable to enable notification"
fi fi
66-yeller set verbosity level to: %b"${VERBOSITY_LEVEL}"%n 66-yeller set verbosity level to: %b"${VERBOSITY_LEVEL}"%n
......
...@@ -3,63 +3,60 @@ ...@@ -3,63 +3,60 @@
@version = @version@ @version = @version@
@description = "Set well-know variables for @I user" @description = "Set well-know variables for @I user"
@user = ( root ) @user = ( root )
@options = ( log )
[start] [start]
@runas = @I @runas = @I
@execute = @execute =
( (
execl-subuidgid execl-subuidgid
backtick -n HOME { homeof @I } backtick -n HOME { homeof @I }
importas -u HOME HOME importas -u HOME HOME
execl-toc -v3 -d @PATH_ENVIRONMENT@ execl-toc -v3 -d @PATH_ENVIRONMENT@
redirfd -w 1 @PATH_ENVIRONMENT@/svscan@@I redirfd -w 1 @PATH_ENVIRONMENT@/svscan@@I
## GENERAL VARIABLES ## GENERAL VARIABLES
if { 66-echo HOME=${HOME} } if { 66-echo -- HOME=${HOME} }
if { 66-echo LOGNAME=@I } if { 66-echo -- LOGNAME=@I }
if { 66-echo USER=@I } if { 66-echo -- USER=@I }
foreground { foreground {
importas PATH PATH importas PATH PATH
66-echo -- PATH=${PATH} 66-echo -- PATH=${PATH}
} }
foreground { foreground {
backtick -D /usr/bin/sh -n shell { backtick -D /usr/bin/sh -E shell {
pipeline { getent passwd ${UID} } pipeline { getent passwd ${UID} }
cut -d: -f7 cut -d: -f7
} }
importas -u shell shell 66-echo -- SHELL=${shell}
66-echo -- SHELL=${shell} }
} foreground
foreground {
{ backtick -E x
backtick -n x {
{ sh -c "d=0 ; while true ; do \
sh -c "d=0 ; while true ; do \ if [ ! -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ]; then \
if [ ! -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ]; then \ 66-echo -- $d ; \
66-echo -- $d ; \ break ; \
break ; \ fi ; \
fi ; \ d=$(($d + 1)) ; \
d=$(($d + 1)) ; \ done ;"
done ;" }
} 66-echo -- DISPLAY=:${x}
importas -u x x }
66-echo -- DISPLAY=:${x} ## DBUS
}
## DBUS if { 66-echo -- DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/bus }
if { 66-echo -- DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/bus } ## XDG variables
## XDG variables if { 66-echo -- XDG_RUNTIME_DIR=/run/user/${UID} }
if { 66-echo -- XDG_CACHE_HOME=${HOME}/.cache }
if { 66-echo -- XDG_RUNTIME_DIR=/run/user/${UID} } if { 66-echo -- XDG_CONFIG_HOME=${HOME}/.config }
if { 66-echo -- XDG_CACHE_HOME=${HOME}/.cache } if { 66-echo -- XDG_DATA_HOME=${HOME}/.local/share }
if { 66-echo -- XDG_CONFIG_HOME=${HOME}/.config } if { 66-echo -- XDG_DATA_DIRS=${HOME}/.local/share:/usr/local/share:/usr/share }
if { 66-echo -- XDG_DATA_HOME=${HOME}/.local/share } 66-echo -- XDG_SESSION_CLASS=user
if { 66-echo -- XDG_DATA_DIRS=${HOME}/.local/share:/usr/local/share:/usr/share }
66-echo -- XDG_SESSION_CLASS=user
) )
...@@ -3,19 +3,28 @@ ...@@ -3,19 +3,28 @@
@version = @version@ @version = @version@
@description = "Create and start a nested scandir for @I" @description = "Create and start a nested scandir for @I"
@user = ( root ) @user = ( root )
@options = ( log env )
@depends = ( setenv@@I ) @depends = ( setenv@@I )
#@options = ( !log )
@notify = 3 @notify = 3
@timeout-up = 3000 @timeout-up = 3000
[start] [start]
@runas = @I @runas = @I
@execute = @execute = (
( s6-setsid -qb --
s6-setsid -qb -- umask 022
umask 022 if {
execl-cmdline -s { 66-scandir ${cmd_args} -cu } execl-cmdline -s { 66-scandir ${cmd_args_scandir} create }
}
execl-cmdline -s { 66-scanctl ${cmd_args_scanctl} start }
)
[stop]
@runas = @I
@execute = (
66-scanctl @LIVE_DIR@ stop
) )
[environment] [environment]
cmd_args=!@VERBOSITY_LEVEL@ @NOTIFY@ @LIVE_DIR@ @USE_ENVIRONMENT@ cmd_args_scandir=!@VERBOSITY_LEVEL@ @LIVE_DIR@
cmd_args_scanctl=!@VERBOSITY_LEVEL@ @NOTIFY@ @LIVE_DIR@ @USE_ENVIRONMENT@
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
@version = @VERSION@ @version = @VERSION@
@description = "Create a nested scandir for @I" @description = "Create a nested scandir for @I"
@user = ( root ) @user = ( root )
@options = ( env )
[regex] [regex]
@configure="@I" @configure="@I"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment