Skip to content

Commit 75eded9

Browse files
committed
Install single user files directly on root folder
1 parent e08209d commit 75eded9

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"buildDependencies": [
2222
"libfuse",
2323
"nodeos-boot-multiUser",
24-
"nodeos-boot-singleUser",
2524
"nodeos-boot-singleUserMount",
2625
"nodeos-cross-toolchain",
2726
"nodeos-nodejs",
@@ -38,7 +37,6 @@
3837
"libfuse": "^2.9.8-3",
3938
"nodeos-barebones": "^1.0.0-RC3.1",
4039
"nodeos-boot-multiUser": "^0.5.3",
41-
"nodeos-boot-singleUser": "^0.5.2",
4240
"nodeos-boot-singleUserMount": "^0.5.2",
4341
"nodeos-cross-toolchain": "^1.0.0-RC3.1",
4442
"nodeos-nodejs": "^6.9.5-0",

scripts/build

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -88,51 +88,36 @@ if [[ ! -d $STEP_DIR ]]; then
8888
#
8989

9090
# Empty, single user system with `$HOME` in another partition
91+
# TODO `OverlayFS` require workdir and upperdir must be separate subtrees, so
92+
# maybe it's a non-sense and should use a `multiUser` partition with a single
93+
# folder instead... what's ugly for pendrives :-(
9194
if [[ -z "$SINGLE_USER" ]]; then
92-
INIT=nodeos-boot-singleUserMount
93-
94-
# Multiple users system
95-
elif [[ "$SINGLE_USER" == "nodeos-boot-multiUser" ]]; then
96-
INIT=nodeos-boot-multiUser
97-
98-
# Package defined, single process OS without persistence
99-
else
100-
(
101-
STEP_DIR=$STEP_DIR/tmp
102-
103-
mkdir -p $STEP_DIR || exit 23
104-
105-
eval "$NPMi" -g $SINGLE_USER || exit 24
106-
107-
# Set `/init` to package binary or `server.js` file
108-
MODULE=lib/node_modules/$SINGLE_USER
109-
PACKAGE_JSON=$STEP_DIR/$MODULE/package.json
110-
SERVER=$MODULE/server.js
111-
112-
(
113-
BIN=bin/`pkg-bin $PACKAGE_JSON` && \
114-
ls $STEP_DIR/$BIN && \
115-
ln -fs $BIN $STEP_DIR/init
116-
) \
117-
|| \
118-
(
119-
ls $STEP_DIR/$SERVER && \
120-
ln -fs $SERVER $STEP_DIR/init
121-
) \
122-
|| exit 25
123-
) || err $?
124-
125-
INIT=nodeos-boot-singleUser
95+
SINGLE_USER=nodeos-boot-singleUserMount
12696
fi
12797

128-
eval "$NPMi" -g $INIT --has_libblkid=false \
129-
--fuse__include_dirs=$SRC_FUSE/include/fuse \
130-
--fuse__library_dirs=$SRC_FUSE/lib \
131-
--fuse__libraries=-lfuse || err 26
98+
eval "$NPMi" -g $SINGLE_USER --has_libblkid=false \
99+
--fuse__include_dirs=$SRC_FUSE/include/fuse \
100+
--fuse__library_dirs=$SRC_FUSE/lib \
101+
--fuse__libraries=-lfuse || err 23
132102

133-
mkdir -p $STEP_DIR/sbin &&
134-
ln -fs ../bin/$INIT $STEP_DIR/sbin/init || err 27
103+
mkdir -p $STEP_DIR/sbin || err 24
135104

105+
# Set `/sbin/init` to package binary or `server.js` file
106+
MODULE=lib/node_modules/$SINGLE_USER
107+
PACKAGE_JSON=$STEP_DIR/$MODULE/package.json
108+
SERVER=$MODULE/server.js
109+
110+
(
111+
BIN=bin/`pkg-bin $PACKAGE_JSON` && \
112+
ls $STEP_DIR/$BIN && \
113+
ln -fs ../$BIN $STEP_DIR/sbin/init
114+
) \
115+
|| \
116+
(
117+
ls $STEP_DIR/$SERVER && \
118+
ln -fs ../$SERVER $STEP_DIR/sbin/init
119+
) \
120+
|| exit 25
136121

137122
echo -e "${GRN}Successfully generated initramfs${CLR}"
138123
fi
@@ -155,6 +140,8 @@ if [[ ! -f $STEP_DIR ]]; then
155140
mkdir -p `dirname $STEP_DIR`
156141

157142
(
143+
# TODO with `nodeos-boot-singleUser`, set user files user:group to `1:1`.
144+
# This would require to set the global ones to `0:0` before installing them
158145
cd "$OBJ_DIR" &&
159146
find | cpio --owner 0:0 -o -H newc | gzip || exit 40
160147
) > $STEP_DIR || err $?

0 commit comments

Comments
 (0)