Skip to content

Commit d5d774d

Browse files
committed
Allow to create single user images
1 parent 4f3f74a commit d5d774d

2 files changed

Lines changed: 49 additions & 24 deletions

File tree

package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"prebuild-install": "^2.1.0"
2020
},
2121
"buildDependencies": [
22-
"exclfs",
23-
"jocker",
2422
"libfuse",
2523
"nodeos-boot-multiUser",
24+
"nodeos-boot-singleUser",
25+
"nodeos-boot-singleUserMount",
2626
"nodeos-cross-toolchain",
2727
"nodeos-nodejs",
2828
"usrbinenv"
@@ -34,23 +34,18 @@
3434
],
3535
"devDependencies": {
3636
"ci-publish": "^1.3.0",
37-
"exclfs": "piranna/exclfs",
38-
"jocker": "^0.0.1",
3937
"libfuse": "^2.9.8-3",
4038
"nodeos-barebones": "^1.0.0-RC3.1",
41-
"nodeos-boot-multiUser": "^0.4.3",
39+
"nodeos-boot-multiUser": "^0.5.0",
40+
"nodeos-boot-singleUser": "^0.5.0",
41+
"nodeos-boot-singleUserMount": "^0.5.0",
4242
"nodeos-cross-toolchain": "^1.0.0-RC3.1",
4343
"nodeos-nodejs": "^6.9.5-0",
4444
"prebuild": "^6.0.2",
4545
"qemu": "^2.8.0",
4646
"suppose": "^0.6.1",
4747
"usrbinenv": "^0.1.0"
4848
},
49-
"nodeosDependencies": [
50-
"jocker",
51-
"nodeos-boot-multiUser",
52-
"usrbinenv"
53-
],
5449
"repository": {
5550
"type": "git",
5651
"url": "git+https://github.com/NodeOS/nodeos-initramfs.git"

scripts/build

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,61 @@ if [[ ! -d $STEP_DIR ]]; then
6262
rmStep $OUT_DIR
6363

6464

65-
# Install FUSE & ExclFS
65+
# Install FUSE
6666

6767
SRC_FUSE=$SRC_FUSE/out/$CPU
6868

69-
eval "$NPMi" -g piranna/exclfs \
70-
--fuse__include_dirs=$SRC_FUSE/include/fuse \
71-
--fuse__library_dirs=$SRC_FUSE/lib \
72-
--fuse__libraries=-lfuse || err 20
69+
mkdir -p $STEP_DIR/lib &&
70+
cp $SRC_FUSE/lib/libfuse.so* $STEP_DIR/lib || exit 20
7371

74-
cp $SRC_FUSE/lib/libfuse.so* $STEP_DIR/lib || err 21
7572

73+
# Install usrbinenv
7674

77-
# Install system dependencies
75+
eval "$NPMi" -g usrbinenv || err 21
7876

79-
PACKAGES=`node -p "require('./package.json').nodeosDependencies.join(' ')"`
80-
eval "$NPMi" -g $PACKAGES --has_libblkid=false || err 22
77+
mkdir -p $STEP_DIR/usr/bin &&
78+
ln -fs ../../bin/env $STEP_DIR/usr/bin/env || err 22
8179

82-
mkdir -p $STEP_DIR/sbin &&
83-
ln -fs ../bin/nodeos-boot-multiUser $STEP_DIR/sbin/init || err 23
8480

81+
#
82+
# Install system init
83+
#
8584

86-
# /usr/bin/env
85+
# Default: multiple users system
86+
SINGLE_USER=${SINGLE_USER-"nodeos-boot-multiUser"}
87+
echo SINGLE_USER: \"$SINGLE_USER\"
88+
89+
# Empty, single user system with `$HOME` in another partition
90+
if [[ -z "$SINGLE_USER" ]]; then
91+
INIT=nodeos-boot-singleUserMount
92+
93+
# Multiple users system
94+
elif [[ "$SINGLE_USER" == "nodeos-boot-multiUser" ]]; then
95+
INIT=nodeos-boot-multiUser
96+
97+
# Package defined, single process OS without persistence
98+
else
99+
(
100+
STEP_DIR=$STEP_DIR/tmp
101+
102+
mkdir -p $STEP_DIR || exit 23
103+
104+
eval "$NPMi" -g $SINGLE_USER || exit 24
105+
106+
ln -fs bin/$SINGLE_USER $STEP_DIR/init || exit 25
107+
) || err $?
108+
109+
INIT=nodeos-boot-singleUser
110+
fi
111+
112+
eval "$NPMi" -g $INIT --has_libblkid=false \
113+
--fuse__include_dirs=$SRC_FUSE/include/fuse \
114+
--fuse__library_dirs=$SRC_FUSE/lib \
115+
--fuse__libraries=-lfuse || err 26
116+
117+
mkdir -p $STEP_DIR/sbin &&
118+
ln -fs ../bin/$INIT $STEP_DIR/sbin/init || err 27
87119

88-
mkdir -p $STEP_DIR/usr/bin &&
89-
ln -fs ../../bin/env $STEP_DIR/usr/bin/env || err 24
90120

91121
echo -e "${GRN}Successfully generated initramfs${CLR}"
92122
fi

0 commit comments

Comments
 (0)