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
## Requirements
- 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/).
## Standard usage
......@@ -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.
## Runtime dependencies
- execline version 2.6.0.2 or later: http://skarnet.org/software/execline/
- s6 version 2.9.1.0 or later: http://skarnet.org/software/s6/
- 66 version 0.5.1.0 or later https://framagit.org/Obarun/66/
- 66-tools version 0.0.6.2 or later https://framagit.org/Obarun/66-tools/
- execline version 2.7.0.0 or later: http://skarnet.org/software/execline/
- s6 version 2.10.0.0 or later: http://skarnet.org/software/s6/
- 66 version 0.6.0.0 or later https://framagit.org/Obarun/66/
- 66-tools version 0.0.7.0 or later https://framagit.org/Obarun/66-tools/
- optional dependencies:
* dbus-66serv version 0.2.0 or later https://framagit.org/pkg/observice/dbus-66serv
......@@ -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
- Convenient release to udpate dependencies:
- 66 v0.5.1.0
- 66-tools v0.0.6.2
- optional dependency:
- dbus-66serv 0.2.0 for environment configuration
- 66 v0.5.1.0
- 66-tools v0.0.6.2
- optional dependency:
- dbus-66serv 0.2.0 for environment configuration
---
......@@ -19,5 +27,5 @@
---
# In 0.1.0
- first commit
......@@ -15,7 +15,7 @@ owner="${1}"
home_env=$(homeof "${owner}" 2>/dev/null)
if [ -z "${home_env}" ]; then
die "invalid user: ${owner}"
die "invalid user: ${owner}"
fi
home_env="${home_env}/${MOD_SERVICE_USERCONFDIR}svscan@${owner}"
......@@ -24,73 +24,73 @@ service_dir="${MOD_MODULE_DIR}/service@"
svscan="${service_dir}/svscan@"
check_empty_var(){
name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}"
fi
name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}"
fi
}
disable() {
name=${1}
66-yeller %rdisable%n service: "${name}"
sed -i "s:${name}:#${name}:g" "${svscan}" || die "unable to sed ${service_dir}/scandir@"
name=${1}
66-yeller %rdisable%n service: "${name}"
sed -i "s:${name}:#${name}:g" "${svscan}" || die "unable to sed ${service_dir}/scandir@"
}
enable() {
name=${1}
66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}"
name=${1}
66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}"
}
absolute_path(){
name="${1}" var="${2}"
if [ "$(66-yeller -i "${var}" | cut -c 1)" != "/" ]; then
die "${name}" must be an absolute path
fi
name="${1}" var="${2}"
if [ "$(66-yeller -i "${var}" | cut -c 1)" != "/" ]; then
die "${name}" must be an absolute path
fi
}
if execl-toc -X -V LIVE_DIRECTORY; then
check_empty_var "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
absolute_path "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
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"
check_empty_var "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
absolute_path "LIVE_DIRECTORY" "${LIVE_DIRECTORY}"
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"
else
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"
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"
fi
if [ "${USE_ENVIRONMENT}" = yes ]; then
enable "setenv@${owner}"
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"
if [ "${USE_ENVIRONMENT}" = yes ]; then
enable "setenv@${owner}"
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"
else
disable "setenv@@I"
sed -i "s:@USE_ENVIRONMENT@::" "${svscan}" || die "unable to set environment directory to use"
disable "setenv@@I"
sed -i "s:@USE_ENVIRONMENT@::" "${svscan}" || die "unable to set environment directory to use"
fi
if [ "${LOGGER}" != "yes" ]; then
66-yeller %rdisable%n logger options
sed -i "s:@options:#@options:" "${svscan}" || die "unable to disable log options"
66-yeller %rdisable%n logger options
sed -i "s:#@options:@options:" "${svscan}" || die "unable to disable log options"
else
66-yeller %benable%n logger options
66-yeller %benable%n logger options
fi
if [ "${NOTIFY}" != "yes" ]; then
66-yeller %rdisable%n notification
sed -i "s:@NOTIFY@::" "${svscan}" || die "unable to disable notification"
sed -i "s:@notify:#@notify:" "${svscan}" || die "unable to disable notification"
66-yeller %rdisable%n notification
sed -i "s:@NOTIFY@::" "${svscan}" || die "unable to disable notification"
sed -i "s:@notify:#@notify:" "${svscan}" || die "unable to disable notification"
else
66-yeller %benable%n notification
sed -i "s:@NOTIFY@:-d3:" "${svscan}" || die "unable to enable notification"
66-yeller %benable%n notification
sed -i "s:@NOTIFY@:-d3:" "${svscan}" || die "unable to enable notification"
fi
66-yeller set verbosity level to: %b"${VERBOSITY_LEVEL}"%n
......
......@@ -3,63 +3,60 @@
@version = @version@
@description = "Set well-know variables for @I user"
@user = ( root )
@options = ( log )
[start]
@runas = @I
@execute =
@execute =
(
execl-subuidgid
backtick -n HOME { homeof @I }
importas -u HOME HOME
execl-toc -v3 -d @PATH_ENVIRONMENT@
redirfd -w 1 @PATH_ENVIRONMENT@/svscan@@I
## GENERAL VARIABLES
if { 66-echo HOME=${HOME} }
if { 66-echo LOGNAME=@I }
if { 66-echo USER=@I }
foreground {
importas PATH PATH
66-echo -- PATH=${PATH}
}
foreground {
backtick -D /usr/bin/sh -n shell {
pipeline { getent passwd ${UID} }
cut -d: -f7
}
importas -u shell shell
66-echo -- SHELL=${shell}
}
foreground
{
backtick -n x
{
sh -c "d=0 ; while true ; do \
if [ ! -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ]; then \
66-echo -- $d ; \
break ; \
fi ; \
d=$(($d + 1)) ; \
done ;"
}
importas -u x x
66-echo -- DISPLAY=:${x}
}
## DBUS
if { 66-echo -- DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/bus }
## XDG variables
if { 66-echo -- XDG_RUNTIME_DIR=/run/user/${UID} }
if { 66-echo -- XDG_CACHE_HOME=${HOME}/.cache }
if { 66-echo -- XDG_CONFIG_HOME=${HOME}/.config }
if { 66-echo -- XDG_DATA_HOME=${HOME}/.local/share }
if { 66-echo -- XDG_DATA_DIRS=${HOME}/.local/share:/usr/local/share:/usr/share }
66-echo -- XDG_SESSION_CLASS=user
execl-subuidgid
backtick -n HOME { homeof @I }
importas -u HOME HOME
execl-toc -v3 -d @PATH_ENVIRONMENT@
redirfd -w 1 @PATH_ENVIRONMENT@/svscan@@I
## GENERAL VARIABLES
if { 66-echo -- HOME=${HOME} }
if { 66-echo -- LOGNAME=@I }
if { 66-echo -- USER=@I }
foreground {
importas PATH PATH
66-echo -- PATH=${PATH}
}
foreground {
backtick -D /usr/bin/sh -E shell {
pipeline { getent passwd ${UID} }
cut -d: -f7
}
66-echo -- SHELL=${shell}
}
foreground
{
backtick -E x
{
sh -c "d=0 ; while true ; do \
if [ ! -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ]; then \
66-echo -- $d ; \
break ; \
fi ; \
d=$(($d + 1)) ; \
done ;"
}
66-echo -- DISPLAY=:${x}
}
## DBUS
if { 66-echo -- DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/bus }
## XDG variables
if { 66-echo -- XDG_RUNTIME_DIR=/run/user/${UID} }
if { 66-echo -- XDG_CACHE_HOME=${HOME}/.cache }
if { 66-echo -- XDG_CONFIG_HOME=${HOME}/.config }
if { 66-echo -- XDG_DATA_HOME=${HOME}/.local/share }
if { 66-echo -- XDG_DATA_DIRS=${HOME}/.local/share:/usr/local/share:/usr/share }
66-echo -- XDG_SESSION_CLASS=user
)
......@@ -3,19 +3,28 @@
@version = @version@
@description = "Create and start a nested scandir for @I"
@user = ( root )
@options = ( log env )
@depends = ( setenv@@I )
#@options = ( !log )
@notify = 3
@timeout-up = 3000
[start]
@runas = @I
@execute =
(
s6-setsid -qb --
umask 022
execl-cmdline -s { 66-scandir ${cmd_args} -cu }
@execute = (
s6-setsid -qb --
umask 022
if {
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]
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 @@
@version = @VERSION@
@description = "Create a nested scandir for @I"
@user = ( root )
@options = ( env )
[regex]
@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