Skip to content

Commit 6fa2a4f

Browse files
committed
add 66boot-initial-setup script, small fixes in the template.
1 parent 29fe7a4 commit 6fa2a4f

2 files changed

Lines changed: 47 additions & 5 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
# Script must run as root, otherwise it creates trees
4+
# as the user.
5+
user=$(id -u)
6+
s6-test "$user" -ne 0 && printf "You need to run this script as root! \n" && exit 1
7+
8+
# Infromataion for the user, in case of failure. 66 output is informative, this
9+
# is just a pointer to the docs.
10+
msg_trees() {
11+
printf "Some trees and/or files are already present in the system.\nIf you want to remove them, consult the 66-tree documentation.\n"
12+
exit 1
13+
}
14+
15+
# Create the mandatory boot tree.
16+
66-tree -n boot || msg_trees
17+
# Enable the boot@system service in the boot tree.
18+
66-enable -F -t boot boot@system || msg_trees
19+
# Copy the default boot@conf so that is will survive updates and be accesible
20+
# though /etc/66rc.conf.
21+
cp /etc/66/conf/boot@system/version/.boot@system /etc/66/conf/boot@system/version/boot@system || msg_trees
22+
23+
# Create default tree, enable it and make it current.
24+
66-tree -nEc default || msg_trees
25+
# Enable switch-initutils oneshot service in the default tree.
26+
66-enable switch-initutils || msg_trees
27+
28+
# Create and enable runit tree.
29+
66-tree -nE runit || msg_trees
30+
# Enable the runit service in the runit tree.
31+
66-enable -t runit runit || msg_trees
32+
# Start runit tree after the default tree.
33+
66-tree -S default runit || msg_trees

srcpkgs/boot-66serv/template

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,24 @@ checksum=03b692700030eaae1e882b6df97e84cbbf0180e067291342d5ed9117047475ba
2222
make_dirs="/etc/runit/runsvdir/66 0750 root root"
2323

2424
post_install() {
25-
vinstall ${FILESDIR}/switch-initutils 644 etc/runit/core-services 99-switch-initutils.sh
26-
vbin ${FILESDIR}/66
25+
26+
# Install the switch-initutils core service for runit.
27+
vinstall "${FILESDIR}"/switch-initutils 644 etc/runit/core-services 99-switch-initutils.sh
28+
# Install the 66 wrapper for 66-boot
29+
vbin "${FILESDIR}"/66
30+
# Install the 66boot-initial-setup utility
31+
vbin "${FILESDIR}"/66boot-initial-setup
2732
# Create symlink for the boot@system service configuration file
2833
ln -s /etc/66/conf/boot@system/version/boot@system "${DESTDIR}/etc/66rc.conf"
29-
vlicense LICENSE
34+
35+
# Install runit and switch-initutils services for 66
3036
# @version should be incremented only when there is a change in the specific
3137
# frontend service file.
32-
vinstall ${FILESDIR}/runit 644 usr/share/66/service/
38+
vinstall "${FILESDIR}"/runit 644 usr/share/66/service/
3339
vsed -i "s/@VERSION@/0.0.1/" "${DESTDIR}/usr/share/66/service/runit"
34-
vinstall ${FILESDIR}/switch-initutils-66 644 usr/share/66/service/ switch-initutils
40+
vinstall "${FILESDIR}"/switch-initutils-66 644 usr/share/66/service/ switch-initutils
3541
vsed -i "s/@VERSION@/0.0.1/" "${DESTDIR}/usr/share/66/service/switch-initutils"
42+
43+
# Install license file
44+
vlicense LICENSE
3645
}

0 commit comments

Comments
 (0)