Skip to content

Commit 9d615a5

Browse files
committed
Remove debugfs dependency
`e2fsprog` package has done some changes on version 1.13 that breaks `debugfs` module regarding files names management, so it doesn't works correctly on Ubuntu 16.10
1 parent 2962159 commit 9d615a5

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bin-pwd": "^0.0.0",
4242
"davius": "^0.0.1",
4343
"dhcpjs": "^0.5.0",
44-
"debugfs": "^0.0.2",
44+
"fs-extra": "^0.30.0",
4545
"genext2fs": "^1.4.1-0",
4646
"ifconfig": "NodeOS/ifconfig",
4747
"ip": "NodeOS/ip",

scripts/build

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,27 @@ if [[ ! -f $STEP_DIR ]]; then
172172
pc_* | raspberry_*)
173173
DISK_SIZE=192 # Size in MB
174174

175+
(
176+
cd $OBJECTS
177+
../../scripts/gendevicetable.js nodeos 1 1 || exit 40
178+
) > $STEP_DIR || err $?
179+
175180
genext2fs -b $((DISK_SIZE*1024)) \
176181
--root $OBJECTS \
182+
--devtable $STEP_DIR \
177183
--block-size 1024 \
178184
--bytes-per-inode 4096 \
179185
--reserved-percentage 0 \
180186
--creator-os linux \
181187
--allow-holes \
182-
--squash $STEP_DIR || err 40
188+
--squash $STEP_DIR || err 41
183189

184190
# Set filesystem features and users files permissions
185-
tune2fs $STEP_DIR -O has_journal,filetype > /dev/null || err 41
191+
tune2fs $STEP_DIR -O has_journal,filetype > /dev/null || err 42
186192
e2fsck -y $STEP_DIR > /dev/null
187193
if [ $? -gt 2 ]; then
188-
err 42
194+
err 43
189195
fi
190-
debugfs.chown $STEP_DIR nodeos 1 || err 43
191196

192197
# Mark the newly created filesystem image as the latest one
193198
ln -sf $CPU out/latest || err 44

scripts/gendevicetable.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs-extra')
4+
const relative = require('path').relative
5+
6+
7+
const argv = process.argv
8+
9+
if(argv.length < 4)
10+
{
11+
console.warn('Usage:', argv[1], '<dir> <uid> <gid>')
12+
process.exit(1)
13+
}
14+
15+
const uid = argv[3]
16+
const gid = argv[4]
17+
18+
fs.walk(process.argv[2]).on('data', function(item)
19+
{
20+
const path = relative(process.cwd(), item.path)
21+
const stats = item.stats
22+
const mode = (stats.mode & fs.constants.S_IRWXU).toString(8)
23+
24+
if(stats.isFile()) return console.log(path, 'f', mode, uid, gid)
25+
if(stats.isDirectory()) console.log(path, 'd', mode, uid, gid)
26+
})

0 commit comments

Comments
 (0)