Browse Source

pass to new module format

2.3.1
obarun 2 years ago
parent
commit
905125de5a
  1. 1
      .gitignore
  2. 54
      INSTALL
  3. 36
      INSTALL.md
  4. 88
      Makefile
  5. 49
      NEWS
  6. 57
      NEWS.md
  7. 4
      configure
  8. 88
      module/boot@/configure/configure
  9. 2
      package/info
  10. 95
      service/boot@

1
.gitignore vendored

@ -1,2 +1 @@
boot-66serv/
config.mak

54
INSTALL

@ -1,54 +0,0 @@
Build Instructions
------------------
* Requirements
------------
- A POSIX-compliant C development environment
- GNU make version 3.81 or later
- skalibs version 2.9.1.0 or later: http://skarnet.org/software/skalibs/
- execline version 2.5.3.0 or later: http://skarnet.org/software/execline/
- s6 version 2.9.0.1 or later: http://skarnet.org/software/s6/
- s6-rc version 0.5.1.1 or later: http://skarnet.org/software/s6-rc/
- oblibs version 0.0.6.0 or later: https://framagit.org/Obarun/oblibs/
- 66 version 0.2.6.0 or later https://framagit.org/Obarun/66/
- 66-tools version v0.0.3.1 or later https://framagit.org/Obarun/66-tools/
This software will run on any operating system that implements
POSIX.1-2008, available at:
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
--------------------
- execline version 2.5.3.0 or later: http://skarnet.org/software/execline/
- s6 version 2.9.0.1 or later: http://skarnet.org/software/s6/
- s6-rc version 0.5.1.1 or later: http://skarnet.org/software/s6-rc/
- oblibs version 0.0.6.0 or later: https://framagit.org/Obarun/oblibs/
- 66 version 0.2.6.0 or later: https://framagit.org/Obarun/66/
- 66-tools version 0.0.3.1 or later: https://framagit.org/Obarun/66-tools/
- s6-linux-utils version 2.5.1.1 or later: http://skarnet.org/software/s6-linux-utils/
- s6-portable-utils version 2.2.2.1 or later: http://skarnet.org/software/s6-portable-utils/
- bash
- iproute2
- kmod
optional dependencies:
- iptables
- dmraid
- lvm2
- btrfs-progs
- zfs

36
INSTALL.md

@ -0,0 +1,36 @@
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
- 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/
- s6-rc version 0.5.1.2 or later: http://skarnet.org/software/s6-rc/
- 66 version 0.4.0.0 or later: https://framagit.org/Obarun/66/
- 66-tools version 0.0.4.0 or later: https://framagit.org/Obarun/66-tools/
- s6-linux-utils version 2.5.1.2 or later: http://skarnet.org/software/s6-linux-utils/
- s6-portable-utils version 2.2.2.2 or later: http://skarnet.org/software/s6-portable-utils/
- bash
- iproute2
- kmod
- optional dependencies:
* iptables
* dmraid
* lvm2
* btrfs-progs
* zfs

88
Makefile

@ -42,50 +42,50 @@ $(DESTDIR)$(module_directory)/boot@/service@/%: module/boot@/service@/%
$(DESTDIR)$(service_directory)/%: service/%
exec $(INSTALL) -D -m 644 $< $@
sed -i -e 's,@adm_conf@,$(adm_conf),' \
-e 's,@script_directory@,$(script_directory),' \
-e 's,@skel_directory@,$(skel_directory),' \
-e 's,@version@,$(version),' \
-e 's,@HOSTNAME@,$(HOSTNAME),' \
-e 's,@HARDWARECLOCK@,$(HARDWARECLOCK),' \
-e 's,@TZ@,$(TZ),' \
-e 's,@SETUPCONSOLE@,$(SETUPCONSOLE),' \
-e 's,@TTY@,$(TTY),' \
-e 's,@KEYMAP@,$(KEYMAP),' \
-e 's,@FONT@,$(FONT),' \
-e 's,@FONT_MAP@,$(FONT_MAP),' \
-e 's,@FONT_UNIMAP@,$(FONT_UNIMAP),' \
-e 's,@UDEV@,$(UDEV),' \
-e 's,@SYSCTL@,$(SYSCTL),' \
-e 's,@FORCECHCK@,$(FORCECHCK),' \
-e 's,@LOCAL@,$(LOCAL),' \
-e 's,@CONTAINER@,$(CONTAINER),' \
-e 's,@TMPFILE@,$(TMPFILE),' \
-e 's,@MODULE_KERNEL@,$(MODULE_KERNEL),' \
-e 's,@MODULE_SYSTEM@,$(MODULE_SYSTEM),' \
-e 's,@RANDOMSEED@,$(RANDOMSEED),' \
-e 's,@FSTAB@,$(FSTAB),' \
-e 's,@SWAP@,$(SWAP),' \
-e 's,@LVM@,$(LVM),' \
-e 's,@DMRAID@,$(DMRAID),' \
-e 's,@BTRFS@,$(BTRFS),' \
-e 's,@ZFS@,$(ZFS),' \
-e 's,@CRYPTTAB@,$(CRYPTTAB),' \
-e 's,@IPTABLES@,$(IPTABLES),' \
-e 's,@IP6TABLES@,$(IP6TABLES),' \
-e 's,@CGROUPS@,$(CGROUPS),' \
-e 's,@MNT_PROC@,$(MNT_PROC),' \
-e 's,@MNT_SYS@,$(MNT_SYS),' \
-e 's,@MNT_DEV@,$(MNT_DEV),' \
-e 's,@MNT_RUN@,$(MNT_RUN),' \
-e 's,@MNT_TMP@,$(MNT_TMP),' \
-e 's,@MNT_PTS@,$(MNT_PTS),' \
-e 's,@MNT_SHM@,$(MNT_SHM),' \
-e 's,@MNT_NETFS@,$(MNT_NETFS),' \
-e 's,@POPULATE_SYS@,$(POPULATE_SYS),' \
-e 's,@POPULATE_DEV@,$(POPULATE_DEV),' \
-e 's,@POPULATE_RUN@,$(POPULATE_RUN),' \
-e 's,@POPULATE_TMP@,$(POPULATE_TMP),' $@
sed -i -e "s,@adm_conf@,$(adm_conf)," \
-e "s,@script_directory@,$(script_directory)," \
-e "s,@skel_directory@,$(skel_directory)," \
-e "s,@VERSION@,$(version)," \
-e "s,@HOSTNAME@,$(HOSTNAME)," \
-e "s,@HARDWARECLOCK@,$(HARDWARECLOCK)," \
-e "s,@TZ@,$(TZ)," \
-e "s,@SETUPCONSOLE@,$(SETUPCONSOLE)," \
-e "s,@TTY@,$(TTY)," \
-e "s,@KEYMAP@,$(KEYMAP)," \
-e "s,@FONT@,$(FONT)," \
-e "s,@FONT_MAP@,$(FONT_MAP)," \
-e "s,@FONT_UNIMAP@,$(FONT_UNIMAP)," \
-e "s,@UDEV@,$(UDEV)," \
-e "s,@SYSCTL@,$(SYSCTL)," \
-e "s,@FORCECHCK@,$(FORCECHCK)," \
-e "s,@LOCAL@,$(LOCAL)," \
-e "s,@CONTAINER@,$(CONTAINER)," \
-e "s,@TMPFILE@,$(TMPFILE)," \
-e "s,@MODULE_KERNEL@,$(MODULE_KERNEL)," \
-e "s,@MODULE_SYSTEM@,$(MODULE_SYSTEM)," \
-e "s,@RANDOMSEED@,$(RANDOMSEED)," \
-e "s,@FSTAB@,$(FSTAB)," \
-e "s,@SWAP@,$(SWAP)," \
-e "s,@LVM@,$(LVM)," \
-e "s,@DMRAID@,$(DMRAID)," \
-e "s,@BTRFS@,$(BTRFS)," \
-e "s,@ZFS@,$(ZFS)," \
-e "s,@CRYPTTAB@,$(CRYPTTAB)," \
-e "s,@IPTABLES@,$(IPTABLES)," \
-e "s,@IP6TABLES@,$(IP6TABLES)," \
-e "s,@CGROUPS@,$(CGROUPS)," \
-e "s,@MNT_PROC@,$(MNT_PROC)," \
-e "s,@MNT_SYS@,$(MNT_SYS)," \
-e "s,@MNT_DEV@,$(MNT_DEV)," \
-e "s,@MNT_RUN@,$(MNT_RUN)," \
-e "s,@MNT_TMP@,$(MNT_TMP)," \
-e "s,@MNT_PTS@,$(MNT_PTS)," \
-e "s,@MNT_SHM@,$(MNT_SHM)," \
-e "s,@MNT_NETFS@,$(MNT_NETFS)," \
-e "s,@POPULATE_SYS@,$(POPULATE_SYS)," \
-e "s,@POPULATE_DEV@,$(POPULATE_DEV)," \
-e "s,@POPULATE_RUN@,$(POPULATE_RUN)," \
-e "s,@POPULATE_TMP@,$(POPULATE_TMP)," $@
version:
@echo $(version)

49
NEWS

@ -1,49 +0,0 @@
Changelog for boot-66serv
In 0.2.0.0
----------
- Pass to module type
In 0.1.2.1
----------
- Bugs and typo fix
In 0.1.2.0
----------
- Bugs fix: tmpfiles.sh
- Modules.sh is now pure sh
- Fix swap file: active swap after remounting / rw
- Full support of encryption password using 66-olexec
In 0.1.1.2
----------
- Bugs fix: fix devices-zfs makefile variable
In 0.1.1.1
----------
- Pass zfs to system-Devices bundle
- Wait for all-Mount at system-fsck
- Mount cgroups before run udevd
In 0.1.1.0
----------
- Fix mount of cgroups and zfs
- Update tmpfiles.sh script
- Add local-sethostname service: it overwrite /etc/hostname file with
the value of HOSTNAME from boot.conf
- Ported to 66 version 0.2.1.0: remove @name field
In 0.1.0.1
----------
- Fix permissions of /tmp/.X11-unix and /tmp/.ICE-unix to 1777
In 0.1.0.0
----------
- first commit.

57
NEWS.md

@ -0,0 +1,57 @@
# Changelog for boot-66serv
---
# In 2.0.0
- Pass to module type
---
# In 1.2.1
- Bugs and typo fix
---
# In 1.2.0
- Bugs fix: tmpfiles.sh
- Modules.sh is now pure sh
- Fix swap file: active swap after remounting / rw
- Full support of encryption password using 66-olexec
---
# In 1.1.2
- Bugs fix: fix devices-zfs makefile variable
---
# In 1.1.1
- Pass zfs to system-Devices bundle
- Wait for all-Mount at system-fsck
- Mount cgroups before run udevd
---
# In 1.1.0
- Fix mount of cgroups and zfs
- Update tmpfiles.sh script
- Add local-sethostname service: it overwrite /etc/hostname file with the value of HOSTNAME from boot.conf
- Ported to 66 version 0.2.1.0: remove @name field
---
# In 1.0.1
- Fix permissions of /tmp/.X11-unix and /tmp/.ICE-unix to 1777
---
# In 1.0.0
- first commit.

4
configure vendored

@ -295,9 +295,9 @@ for i in HOSTNAME HARDWARECLOCK TZ SETUPCONSOLE TTY \
MNT_PTS MNT_SHM MNT_NETFS POPULATE_SYS POPULATE_DEV POPULATE_RUN POPULATE_TMP ; do
eval tmp=\${$i}
if testval $tmp; then
eval $i='#${i}='
eval $i='${i}=\"\\#${i}=\"'
else
eval $i='$i=$tmp'
eval $i='$i=$i=$tmp'
fi
done

88
module/boot@/configure/configure vendored

@ -1,21 +1,15 @@
#!@BINDIR@/sh
count=0
for el in ${@}; do
if [ ${count} = 0 ];then
module_name=${el}
elif [ ${count} = 1 ];then
target_symlink_path=${el}
elif [ ${count} = 2 ];then
skeleton_path=${el}
else
version=${el}
fi
: $(( count=count+1 ))
done
## 66-yeller variable
export PROG="${MOD_NAME}"
export VERBOSITY="${MOD_VERBOSITY}"
export CLOCK_ENABLED=0
## script variable
module_name="${MOD_NAME}"
target_symlink_path="${MOD_SERVICE_ADMCONFDIR}"
skeleton_path="${MOD_SKEL_DIR}"
service_dir="${MOD_MODULE_DIR}/service"
SV_REAL=
sv_boolean_list="CRYPTTAB SETUPCONSOLE IPTABLES IP6TABLES FSTAB SWAP LVM \
@ -27,8 +21,8 @@ sv_container_list="HARDWARECLOCK SETUPCONSOLE CRYPTTAB SWAP LVM DMRAID BTRFS \
ZFS UDEV UDEV_ADM SYSCTL FORCECHCK CGROUPS MODULE_SYSTEM RANDOMSEED MNT_NETFS"
die(){
printf "%s\n" "$*"
exit 1
66-yeller -f "${@}"
exit 111
}
retrieve_sv_name(){
@ -75,42 +69,49 @@ retrieve_sv_name(){
}
sv_uncomment_list() {
name=${1} list="$(find ../service -mindepth 1 -type f)"
name=${1} list="$(find "${service_dir}" -mindepth 1 -type f)"
retrieve_sv_name "${name}"
66-yeller %benable%n service: "${SV_REAL}"
for sv in ${list}; do
dir=${sv%/*}
dir=${dir#*/}
sed -i "s:#*${SV_REAL}:${SV_REAL}:g" "${sv}" || die "fatal: unable to sed ${sv}"
sed -i "s:#*${SV_REAL}:${SV_REAL}:g" "${sv}" || die "unable to sed ${sv}"
done
unset list
}
sv_comment_list() {
name=${1} list="$(find ../service -mindepth 1 -type f)"
name=${1} list="$(find "${service_dir}" -mindepth 1 -type f)"
file=
retrieve_sv_name "${name}"
66-yeller %rdisable%n service: "${SV_REAL}"
for sv in ${list}; do
dir=${sv%/*}
dir=${dir#*/}
sed -i "s:${SV_REAL}:#${SV_REAL}:g" "${sv}" || die "fatal: unable to sed ${sv}"
sv_name=${sv##*/}
if [ "${SV_REAL}" = "${sv_name}" ];then
file="${sv}"
fi
sed -i "s:${SV_REAL}:#${SV_REAL}:g" "${sv}" || die "unable to sed ${sv}"
done
file="$(find ../service -mindepth 1 -name ${SV_REAL})"
rm -f "${file}"
if [ -n "${file}" ];then
rm -f "${file}" || die "unable to remove ${file}"
fi
unset list
}
sv_comment_real() {
name=${1} list="$(find ../service -mindepth 1 -type f)"
name=${1} list="$(find "${service_dir}" -mindepth 1 -type f)"
66-yeller %rdisable%n service: "${name}"
file=
for sv in ${list}; do
dir=${sv%/*}
dir=${dir#*/}
sed -i "s:${name}:#${name}:g" "${sv}" || die "fatal: unable to sed ${sv}"
sv_name=${sv##*/}
if [ "${name}" = "${sv_name}" ];then
file="${sv}"
fi
sed -i "s:${name}:#${name}:g" "${sv}" || die "unable to sed ${sv}"
done
file=$(find ../service -mindepth 1 -name "${name}")
rm -f "${file}"
if [ -n "${file}" ];then
rm -f "${file}" || die "unable to remove ${file}"
fi
}
for sv in ${sv_boolean_list}; do
@ -119,7 +120,6 @@ for sv in ${sv_boolean_list}; do
fi
eval val="\$${sv}"
val="${val}"
if [ "${val}" = "yes" ]; then
sv_uncomment_list "${sv}"
else
@ -127,7 +127,7 @@ for sv in ${sv_boolean_list}; do
fi
done
uncomment_udev() {
comment_udev() {
for sv in "udevd" "udevadm" "system-fontnkey" "devices-crypttab" \
"devices-dmraid" "devices-btrfs" "devices-lvm" ; do
sv_comment_real ${sv}
@ -135,7 +135,7 @@ uncomment_udev() {
}
if [ "${UDEV}" = "no" ]; then
uncomment_udev
comment_udev
fi
if [ "${CONTAINER}" = "yes" ]; then
@ -155,10 +155,12 @@ fi
if [ "${TTY}" -gt 0 ]; then
for i in $(seq "${TTY}"); do
[ "${i}" -lt 12 ] || break
cp ../service@/tty-rc@ ../service/tty-rc@tty"${i}" || die "fatal: unable to copy tty-rc@ service"
sed "s:@I:tty${i}:g" -i ../service/tty-rc@tty"${i}" || die "fatal: unable to sed tty-rc@tty${i}"
sed "s:@vers@:${version}:" -i ../service/tty-rc@tty"${i}" || die "fatal: unable to sed tty-rc@tty${i}"
66-yeller %benable%n service: "tty-rc@tty${i}"
touch "${service_dir}/tty-rc@tty${i}" || die "unable to create ${service_dir}/tty-rc@tty${i}"
done
fi
ln -sf "${target_symlink_path}/${module_name}" "${skeleton_path}/${module_name}" || die "fatal: unable to make symlink"
66-yeller %bcreate%n "${skeleton_path}${module_name} symlink"
ln -sf "${target_symlink_path}${module_name}" "${skeleton_path}${module_name}" || die "unable to make symlink"
66-yeller "%bsuccessfully%n configured"

2
package/info

@ -1,3 +1,3 @@
package=boot-66serv
version=0.2.0.0
version=2.0.0
package_macro_dir=66

95
service/boot@

@ -1,18 +1,17 @@
[main]
@type = module
@version = @version@
@description = "Module to boot a machine"
@version = @VERSION@
@description = "Set of service to boot a machine"
@user = (root)
@options = ( env )
[regex]
@configure="boot@@I /etc/66/conf /etc/66 @version@"
@infiles = (
::@bootconf@=/etc/66/conf/boot@@I
::@scripts@=/usr/lib/66/script
::@initconf@=/etc/66/init.conf
::@skeldir@=/etc/66
::@vers@=@version@
::@bootconf@=@adm_conf@/boot@@I
::@scripts@=@script_directory@
::@initconf@=@skel_directory@/init.conf
::@skeldir@=@skel_directory@
::@vers@=@VERSION@
)
@addservices = ( tty@tty12 )
@ -44,62 +43,62 @@
## Set the HOSTNAME.
HOSTNAME=obarunS6
@HOSTNAME@
## Set RTC [UTC|localtime].
HARDWARECLOCK=UTC
@HARDWARECLOCK@
## Set timezone, availables timezones at /usr/share/zoneinfo.
TZ=GMT
@TZ@
## Setup the console
## If set to no, KEYMAP,FONT,FONT_MAP,FONT_UNIMAP has no effects
SETUPCONSOLE=!yes
@SETUPCONSOLE@
## Set the number of tty to start.
## 0 means no tty. Maximum is 11.
TTY=!2
@TTY@
#====================== System configuration ===========================
## keymap to load, see loadkeys(8).
KEYMAP=!us
@KEYMAP@
## Console font to load, see setfont(8).
FONT=!lat9w-16
@FONT@
## Console map to load, see setfont(8).
#FONT_MAP=
@FONT_MAP@
## Console unimap to load, see setfont(8).
#FONT_UNIMAP=
@FONT_UNIMAP@
## Use udev [yes|no]
## If set to no the following variables has no effects or set to no:
## SETUPCONSOLE, KEYMAP, FONT, FONT_MAP, FONT_UNIMAP, CRYPTTAB, DMRAID,
## BTRFS, LVM
UDEV=!yes
@UDEV@
## Kernel configuration with sysctl [yes|no].
SYSCTL=!yes
@SYSCTL@
## Force a check of filesystem partition [yes|no].
FORCECHCK=!no
@FORCECHCK@
## Use rc.local script [yes|no].
LOCAL=!no
@LOCAL@
## Boot inside a container [yes|no].
## If set to yes the following variables has no effects or set to no:
@ -107,120 +106,120 @@ LOCAL=!no
## SWAP, LVM, DMRAID, BTRFS, ZFS, UDEV, SYSCTL, FORCECHCK, CGROUPS
## MODULE_SYSTEM, RANDOMSEED, MNT_NETFS
CONTAINER=!no
@CONTAINER@
## Apply tmpfiles.d configuration file [yes|no].
TMPFILE=!yes
@TMPFILE@
## Load kernel modules [yes|no].
MODULE_KERNEL=!yes
@MODULE_KERNEL@
## Load modules from modules.d files
MODULE_SYSTEM=!yes
@MODULE_SYSTEM@
## Populate ramdom seed
RANDOMSEED=!yes
@RANDOMSEED@
#========================== Devices ====================================
## Mount devices from FSTAB file [yes|no].
FSTAB=!yes
@FSTAB@
## Active swap [yes|no].
SWAP=!no
@SWAP@
## Active lvm devices [yes|no].
LVM=!no
@LVM@
## Active dmraid devices [yes|no].
DMRAID=!no
@DMRAID@
## Active btrfs devices [yes|no].
BTRFS=!no
@BTRFS@
## Mount zfs devices [yes|no].
ZFS=!no
@ZFS@
#========================== Security ===================================
## Active encrypted devices [yes|no].
CRYPTTAB=!no
@CRYPTTAB@
## Use iptables [yes|no].
IPTABLES=!no
@IPTABLES@
## Use ip6tables [yes|no].
IP6TABLES=!no
@IP6TABLES@
#========================== Pseudo filesystem ==========================
## Mount cgroups [yes|no].
CGROUPS=!yes
@CGROUPS@
## Mount /proc directory [yes|no].
MNT_PROC=!yes
@MNT_PROC@
## Mount /sys directory [yes|no].
MNT_SYS=!yes
@MNT_SYS@
## Mount /dev directory [yes|no].
MNT_DEV=!yes
@MNT_DEV@
## Mount /run directory [yes|no].
MNT_RUN=!yes
@MNT_RUN@
## Mount /tmp directory [yes|no].
MNT_TMP=!yes
@MNT_TMP@
## Mount /dev/pts directory [yes|no].
## Only valuable if MNT_DEV is set to yes.
MNT_PTS=!yes
@MNT_PTS@
## Mount /dev/shm directory [yes|no].
## Only valuable if MNT_DEV is set to yes.
MNT_SHM=!yes
@MNT_SHM@
## Mount no-network filesystem [yes|no].
## Fstype mounted is: nosysfs,nonfs,nonfs4,nosmbfs,nocifs
MNT_NETFS=!yes
@MNT_NETFS@
## Create and mount /sys/firmware/efi/efivars, /sys/fs/fuse/connections,
## /sys/kernel/{config,debug,security} and /sys/kernel/debug/tracing
## if exist at /proc/filesystems
POPULATE_SYS=!yes
@POPULATE_SYS@
## Create and mount /dev/{hugepages,mqueue}
## if exist at /proc/filesystems
POPULATE_DEV=!yes
@POPULATE_DEV@
## Create /run/{lvm,user,lock,utmp} directories
POPULATE_RUN=!yes
@POPULATE_RUN@
## Create /tmp/{.X11-unix,.ICE-unix} files
POPULATE_TMP=!yes
@POPULATE_TMP@

Loading…
Cancel
Save