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

Bump v0.3.0

parent 23d0b3c2
No related branches found
No related tags found
No related merge requests found
Showing
with 436 additions and 229 deletions
*-66mod/
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
`./configure && make && sudo make install` will work for most users.
## Customization
You can customize paths via flags given to configure. See `./configure --help` for a list of all available configure options.
## Runtime dependencies
- 66-tools version 0.0.4.0 or later https://framagit.org/Obarun/66-tools/
- scandir-66serv version 0.1.0 or later https://framagit.org/pkg/obmods/scandir-66erv
- console-tracker-66serv version 0.1.0 or later https://framagit.org/pkg/obmods/console-tracker-66serv
- display-manager-66serv version 0.1.0 or later https://framagit.org/pkg/obmods/display-manager-66serv
Copyright (c) 2018-2019 Eric Vidal <eric@obarun.org>
Copyright (c) 2015-2020 Eric Vidal <eric@obarun.org>
All rights reserved.
Permission to use, copy, modify, and/or distribute this software for any
......
Makefile 0 → 100644
#
# This Makefile requires GNU make.
#
# Do not make changes here.
# Use the included .mak files.
#
make_need := 3.81
ifeq "" "$(strip $(filter $(make_need), $(firstword $(sort $(make_need) $(MAKE_VERSION)))))"
fail := $(error Your make ($(MAKE_VERSION)) is too old. You need $(make_need) or newer)
endif
-include config.mak
include package/targets.mak
INSTALL := ./tools/install.sh
install: install-script install-service install-service-module install-service-instance-module install-configure
install-script: $(SCRIPT_TARGET:module/boot-user@/configure/%=$(DESTDIR)$(module_directory)/boot-user@/configure/%)
install-service: $(SERVICE_TARGET:service/%=$(DESTDIR)$(service_directory)/%)
install-service-module: $(MODULE_TARGET:module/boot-user@/service/%=$(DESTDIR)$(module_directory)/boot-user@/service/%)
install-service-instance-module: $(MODULE_INSTANCE_TARGET:module/boot-user@/service@/%=$(DESTDIR)$(module_directory)/boot-user@/service@/%)
install-configure: $(MODULE_CONFIGURE_TARGET:module/boot-user@/configure/configure=$(DESTDIR)$(module_directory)/boot-user@/configure/configure)
$(DESTDIR)$(module_directory)/boot-user@/configure/%: module/boot-user@/configure/%
exec $(INSTALL) -D -m 755 $< $@
sed -i -e 's,@BINDIR@,$(bindir),' $@
$(DESTDIR)$(module_directory)/boot-user@/configure/configure: module/boot-user@/configure/configure
exec $(INSTALL) -D -m 755 $< $@
sed -i -e 's,@BINDIR@,$(bindir),' $@
$(DESTDIR)$(module_directory)/boot-user@/service/%: module/boot-user@/service/%
exec $(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(module_directory)/boot-user@/service@/%: module/boot-user@/service@/%
exec $(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(service_directory)/%: service/%
exec $(INSTALL) -D -m 644 $< $@
sed -i -e 's,@VERSION@,$(version),' \
-e "s,@DISPLAY_MANAGER@,$(DISPLAY_MANAGER)," \
-e "s,@CONSOLE_TRACKER@,$(CONSOLE_TRACKER)," \
-e "s,@XDG_RUNTIME@,$(XDG_RUNTIME)," \
-e "s,@DESKTOP_CMDLINE@,$(DESKTOP_CMDLINE)," $@
version:
@echo $(version)
.PHONY: install version
.DELETE_ON_ERROR:
Changelog for boot-user-66mod
In 0.2.1
--------
-Bugs fix
In 0.1.0
----------
- Bugs fix.
In 0.0.1
----------
- first commit.
NEWS.md 0 → 100644
# Changelog for boot-user-66serv
---
# In 0.3.0
- Pass to new module format
---
# In 0.2.1
-Bugs fix
---
# In 0.1.0
- Bugs fix.
---
# In 0.0.1
- first commit.
configure 0 → 100755
#!/bin/sh
. package/info
usage () {
cat <<EOF
Usage: $0 [OPTION]... [TARGET]
Defaults for the options are specified in brackets.
Installation directories:
--prefix=PREFIX main installation prefix [/]
--exec-prefix=EPREFIX installation prefix for executable files [PREFIX]
Fine tuning of the installation directories:
--bindir=BINDIR user executables [EPREFIX/bin]
--datarootdir=DATAROOTDIR read-only architecture-independent data root [PREFIX/share]
--with-system-service=DIR 66 service intallation directory [DATAROOTDIR/$package_macro_dir/service]
--with-system-module=DIR 66 module intallation directory [DATAROOTDIR/$package_macro_dir/module]
Fine tunning of boot-user configuration:
--DISPLAY_MANAGER=VALUE display manager to use []
--CONSOLE_TRACKER=VALUE console tracker to use []
--XDG_RUNTIME=BOOLEAN create and mount the XDG_RUNTIME directory [!yes]
--DESKTOP_CMDLINE=VALUE commandline to use in the .xinitrc file [!jwm]
Use yes or no with lowercase character to set BOOLEAN values.
Empty value is a commented one and not used at all.
An exclamation mark '!' at the begin of the value unexport the variable
for the environment after the use. This is avoid to poluate the environment
with tempory variables. You need to single-quote the options as
follow:
./configure --XDG_RUNTIME='!yes'
EOF
exit 0
}
# Helper functions
# If your system does not have printf, you can comment this, but it is
# generally not a good idea to use echo.
# See http://www.etalabs.net/sh_tricks.html
echo () {
IFS=" "
printf %s\\n "$*"
}
quote () {
tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
$1
EOF
echo "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#" -e "s|\*/|* /|g"
}
fail () {
echo "$*"
exit 1
}
fnmatch () {
eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac"
}
cmdexists () {
type "$1" >/dev/null 2>&1
}
stripdir () {
while eval "fnmatch '*/' \"\${$1}\"" ; do
eval "$1=\${$1%/}"
done
}
testval () {
if test -z ${1}; then
return 0 ;
else
return 1 ;
fi
}
# Actual script
prefix=
exec_prefix='$prefix'
bindir='$exec_prefix/bin'
datarootdir='$prefix/share'
service_directory='$datarootdir/$package_macro_dir/service'
module_directory='$datarootdir/$package_macro_dir/module'
DISPLAY_MANAGER=
CONSOLE_TRACKER=
XDG_RUNTIME='!yes'
DESKTOP_CMDLINE='!jwm'
for arg ; do
case "$arg" in
--help) usage ;;
--prefix=*) prefix=${arg#*=} ;;
--exec-prefix=*) exec_prefix=${arg#*=} ;;
--bindir=*) bindir=${arg#*=} ;;
--datarootdir=*) datarootdir=${arg#*=} ;;
--with-system-service=*) service_directory=${arg#*=} ;;
--with-system-module=*) module_directory=${arg#*=} ;;
--DISPLAY_MANAGER=*) DISPLAY_MANAGER=${arg#*=} ;;
--CONSOLE_TRACKER=*) CONSOLE_TRACKER=${arg#*=} ;;
--XDG_RUNTIME=*) XDG_RUNTIME=${arg#*=} ;;
--DESKTOP_CMDLINE=*) DESKTOP_CMDLINE=${arg#*=} ;;
-* ) echo "$0: unknown option $arg" ;;
*=*) ;;
*) target=$arg ;;
esac
done
# Add /usr in the default case
if test -z "$prefix" ; then
if test "$datarootdir" = '$prefix/share'; then
datarootdir=/usr/share
fi
fi
# Expand installation directories
stripdir prefix
for i in exec_prefix bindir datarootdir \
service_directory module_directory ; do
eval tmp=\${$i}
eval $i=$tmp
stripdir $i
done
stripdir datarootdir
for i in service_directory module_directory; do
eval tmp=\${$i}
eval $i=$tmp
stripdir $i
done
for i in DISPLAY_MANAGER CONSOLE_TRACKER XDG_RUNTIME DESKTOP_CMDLINE; do
eval tmp=\${$i}
if testval $tmp; then
if [ "${i}" = "DISPLAY_MANAGER" ]; then
eval $i='${i}=\"\\#${i}=sddm\"'
elif [ "${i}" = "CONSOLE_TRACKER" ]; then
eval $i='${i}=\"\\#${i}=consolekit\"'
else
eval $i='${i}=\"\\#${i}=\"'
fi
else
eval $i='$i=$i=$tmp'
fi
done
# Get usable temp filenames
i=0
set -C
while : ; do
i=$(($i+1))
tmpc="./tmp-configure-$$-$PPID-$i.c"
tmpe="./tmp-configure-$$-$PPID-$i.tmp"
2>|/dev/null > "$tmpc" && break
2>|/dev/null > "$tmpe" && break
test "$i" -gt 50 && fail "$0: cannot create temporary files"
done
set +C
trap 'rm -f "$tmpc" "$tmpe"' EXIT ABRT INT QUIT TERM HUP
echo "creating config.mak..."
cmdline=$(quote "$0")
for i ; do cmdline="$cmdline $(quote "$i")" ; done
exec 3>&1 1>config.mak
cat << EOF
# This file was generated by:
# $cmdline
# Any changes made here will be lost if configure is re-run.
version := $version
prefix := $prefix
exec_prefix := $exec_prefix
bindir := $bindir
datarootdir := $datarootdir
service_directory := $service_directory
module_directory := $module_directory
package_macro_dir := $package_macro_dir
$DISPLAY_MANAGER
$CONSOLE_TRACKER
$XDG_RUNTIME
$DESKTOP_CMDLINE
EOF
exec 1>&3 3>&-
echo " ... done."
#!/bin/bash
mod="${1}"
home=$(homeof ${mod})
uid=$(id -u ${mod})
gid=$(id -g ${mod})
if [[ -e ${home}/.xsession ]]; then
mv ${home}/.xsession ${home}/.xsession.bak
chown ${uid}:${gid} ${home}/.xsession.bak
fi
if [[ -e ${home}/.xinitrc ]]; then
mv ${home}/.xinitrc ${home}/.xinitrc.bak
chown ${uid}:${gid} ${home}/.xinitrc.bak
fi
cp .xsession ${home}/
chown ${uid}:${gid} ${home}/.xsession
cp .xinitrc ${home}/
chown ${uid}:${gid} ${home}/.xinitrc
Modules name:
- boot-user@
Version:
- 0.2.1
Description:
- This module configure a set of services for an <user> to properly
deal with Display Manager(a.k.a DM).
Module dependencies:
- none
Optional module dependencies:
- none
Service Dependencies:
- none
Optional service dependencies:
- sddm-66serv
- dbus-66serv
- consolekit-66serv
Package dependencies:
- none
Optional package dependencies:
- consolekit
- sddm
- dbus
------------------------------------------------------------------------
Installation directive:
# 66-mods.sh boot-user@<user>
# 66-enable boot-user@<user>
- Dbus and dbus-session@:
- dbus daemon should be enabled and up before
starting the module on a root tree.
- dbus-session@<user> should be enabled on a <user> tree.
It will be brought up at the start of the session.
Note: .xinitrc file execute an JWM session by default. Edit it
to suit your needs.
------------------------------------------------------------------------
Installed file:
- ${HOME}/.xsession file.
An already existing file is renamed to ${HOME}/.xsession.bak.
- ${HOME}/.xinitrc file.
An already existing file is renamad to ${HOME}/.xinitrc.bak.
Service:
- All-<user>
- mount-run-<user>
- setenv-<user>
- scandir-<user>
Runtime:
- It mount /run/user/<uid> of user if doesn't exist.
- It define well-know variable and write it at
${HOME}/.66/conf/boot-user/boot-user-<user>.conf (see below).
This file is created at every start of the setenv-<user> service.
- It create a scandir as <user> as owner merging the environment from
the directory ${HOME}/.66/conf/boot-user/ and start it.
Example of ${HOME}/.66/conf/boot-user/boot-user@<user>.conf file:
HOME=/home/oblive
LOGNAME=obarun
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin
SHELL=/usr/bin/zsh
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
XDG_CACHE_HOME=/home/oblive/.cache
XDG_CONFIG_HOME=/home/oblive/.config
XDG_DATA_HOME=/home/oblive/.local/share
XDG_DATA_DIRS=/home/oblive/.local/share:/usr/local/share:/usr/share
XDG_SESSION_CLASS=user
Note: you can set any new variables creating a new file containing one or
multiple key=value pair into the directory ${HOME}/.66/conf/boot-user/
[main]
@type = bundle
@description = "First service called to start a scandir for @I user"
@user = (root)
@contents = ( mount-run-@I setenv-@I scandir-@I )
#!/usr/bin/bash
#!@BINDIR@/bash
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
......@@ -7,15 +7,14 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
unset f
fi
list=( $(ls -1 ${HOME}/.66/conf/boot-user) )
list=( $(ls -1 @PATH_ENVIRONMENT@) )
for i in ${list[@]};do
var=$(<${HOME}/.66/conf/boot-user/${i})
var=$(@PATH_ENVIRONMENT@/${i})
for j in ${var[@]}; do
export ${j}
done
done
66-all up
## Try consolekit
......@@ -26,6 +25,4 @@ else
fi
## Select the session to start
${cmd} jwm
#${cmd} openbox-session
#${cmd} startkde
${cmd} @DESKTOP_CMDLINE@
#!/usr/bin/bash
#!@BINDIR@/bash
list=( $(ls -1 ${HOME}/.66/conf/boot-user) )
list=( $(ls -1 @PATH_ENVIRONMENT@) )
for i in ${list[@]};do
var=$(<${HOME}/.66/conf/boot-user/${i})
var=$(<@PATH_ENVIRONMENT@/${i})
for j in ${var[@]}; do
export ${j}
done
......
#!@BINDIR@/sh
## 66-yeller variable
export PROG="${MOD_NAME}"
export VERBOSITY="${MOD_VERBOSITY}"
export CLOCK_ENABLED=0
owner="${1}"
home=$(homeof "${owner}")
uid=$(id -u "${owner}")
gid=$(id -g "${owner}")
home_env="${home}/${MOD_SERVICE_USERCONFDIR}svscan@${owner}"
die(){
66-yeller -fc "${@}"
exit 111
}
check_empty_var(){
name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}"
fi
}
enable(){
name="${1}"
66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}" || die "unable to enable ${MOD_MODULE_DIR}/service/${1}"
}
disable(){
name="${1}"
66-yeller %bdisable%n service: "${name}"
rm -f "${MOD_MODULE_DIR}/service/${name}" || die "disable to enable ${MOD_MODULE_DIR}/service/${1}"
}
if execl-toc -X -V DISPLAY_MANAGER; then
check_empty_var "DISPLAY_MANAGER" "${DISPLAY_MANAGER}"
enable "display-manager@${DISPLAY_MANAGER}"
66-yeller set environment at .xsession file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xsession" || die "unable to set environment directory at .xsession file"
if [ -e "${home}/.xsession" ]; then
66-yeller -W "move existing ${home}/.xsession file to ${home}/.xsession.bak"
mv "${home}/.xsession" "${home}/.xsession.bak" || exit 111
fi
66-yeller "create ${home}/.xsession"
cp .xsession "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xsession" || exit 111
fi
if execl-toc -X -V CONSOLE_TRACKER; then
check_empty_var "CONSOLE_TRACKER" "${CONSOLE_TRACKER}"
enable "console-tracker@${CONSOLE_TRACKER}"
fi
if [ "${XDG_RUNTIME}" = "yes" ]; then
enable "mount-run@${owner}"
else
disable "mount-run@${owner}"
fi
if execl-toc -X -V DESKTOP_CMDLINE; then
check_empty_var "DESKTOP_CMDLINE" "${DESKTOP_CMDLINE}"
66-yeller set environment at .xinitrc file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
66-yeller set commandline at .xinitrc file to: %b"${DESKTOP_CMDLINE}"%n
sed -i "s:@DESKTOP_CMDLINE@:${DESKTOP_CMDLINE}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
if [ -e "${home}/.xinitrc" ]; then
66-yeller -W "move existing ${home}/.xinitrc file to ${home}/.xinitrc.bak"
mv "${home}/.xinitrc" "${home}/.xinitrc.bak" || exit 111
fi
66-yeller -c "create ${home}/.xinitrc"
cp .xinitrc "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xinitrc" || exit 111
fi
66-yeller "%bsuccessfully%n configured\n"
[main]
@type = oneshot
@description = "Set well-know variable for @I user"
@user = (root)
[start]
@build = auto
@runas = @I
@execute =
(
execl-subuidgid
backtick -n HOME { homeof @I }
importas -u HOME HOME
foreground
{
if -nt { test -d ${HOME}/.66/conf/boot-user }
mkdir -p ${HOME}/.66/conf/boot-user
}
redirfd -w 1 ${HOME}/.66/conf/boot-user/boot-user@@I.conf
## 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}/dbus }
## 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
)
[main]
@type = oneshot
@description = "Mount /run/user directory of @I"
@user = (root)
[start]
@build = auto
@execute =
(
## create /run/user/<uid>
execl-subuidgid -o @I
foreground {
if -nt { mountpoint -q /run/user/${UID} }
if { mkdir -p /run/user/${UID} }
mount -o noatime,nodev,nosuid,gid=${GID},uid=${UID},mode=0700,size=64M -t tmpfs user /run/user/${UID}
}
)
[main]
@type = longrun
@description = "Start a scandir for @I"
@user = ( root )
@options = ( log )
@depends = ( mount-run-@I setenv-@I )
@notify = 3
@timeout-up = 3000
[start]
@build = auto
@runas = @I
@execute =
(
s6-setsid -qb --
umask 022
66-scandir -v3 -d3 -cu -e /home/@I/.66/conf/boot-user
)
[main]
@type = oneshot
@version = @version@
@description = "Mount /run/user directory of user @I"
@user = ( root )
@options = ( log )
[start]
@build = auto
@execute =
(
if { 66-yeller -p mount-run@@I starts... }
if -nt {
execl-subuidgid -o @I
execl-toc -X -m /run/user/${UID} -o noatime,nodev,nosuid,gid=${GID},uid=${UID},mode=0700,size=64M -t tmpfs -d user
}
66-yeller -fp mount-run@@I crashed!
)
package=boot-user-66serv
version=0.3.0
package_macro_dir=66
configure 0755
SCRIPT_TARGET := \
module/boot@/configure/.xinitrc \
module/boot@/configure/.xsession
SERVICE_TARGET := service/boot-user@
MODULE_TARGET := $(shell find module/boot-user@/service -type f)
MODULE_INSTANCE_TARGET := $(shell find module/boot-user@/service@ -type f)
MODULE_CONFIGURE_TARGET := module/boot-user@/configure/configure
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