diff --git a/README.md b/README.md index 1c7e7c8..2a7de75 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Yama +# Megabit OS Raspberry Pi 向け OS のビルドするためのツール群 diff --git a/apkovl/etc/apk/world b/apkovl/etc/apk/world index 5534b63..222f2dc 100644 --- a/apkovl/etc/apk/world +++ b/apkovl/etc/apk/world @@ -1,4 +1,5 @@ alpine-base i2c-tools openssh +rsync wpa_supplicant diff --git a/apkovl/etc/init.d/megabit b/apkovl/etc/init.d/megabit new file mode 100755 index 0000000..93e0760 --- /dev/null +++ b/apkovl/etc/init.d/megabit @@ -0,0 +1,4 @@ +#!/sbin/openrc-run +name=megabit +command="/usr/local/bin/megabit" +pidfile="/var/run/megabit.pid" diff --git a/apkovl/etc/init.d/megabit-sync b/apkovl/etc/init.d/megabit-sync new file mode 100755 index 0000000..6153b82 --- /dev/null +++ b/apkovl/etc/init.d/megabit-sync @@ -0,0 +1,11 @@ +#!/sbin/openrc-run +name=megabit-sync +command="/usr/local/bin/megabit-sync" +pidfile="/var/run/megabit-sync.pid" + +start_pre() { + mkdir -p /mnt/tmp + mount /usr/share/megabit/tmp.img /mnt/tmp + modprobe -r g_mass_storage + modprobe g_mass_storage file=/usr/share/megabit/tmp.img +} diff --git a/apkovl/etc/modprobe.d/g_mass_storage.conf b/apkovl/etc/modprobe.d/g_mass_storage.conf deleted file mode 100644 index cf8ee44..0000000 --- a/apkovl/etc/modprobe.d/g_mass_storage.conf +++ /dev/null @@ -1 +0,0 @@ -options g_mass_storage file=/dev/mmcblk0p1 diff --git a/apkovl/etc/modules-load.d/g_mass_storage.conf b/apkovl/etc/modules-load.d/g_mass_storage.conf deleted file mode 100644 index fd5ae93..0000000 --- a/apkovl/etc/modules-load.d/g_mass_storage.conf +++ /dev/null @@ -1 +0,0 @@ -g_mass_storage diff --git a/apkovl/etc/runlevels/default/megabit b/apkovl/etc/runlevels/default/megabit new file mode 120000 index 0000000..fb1ac2b --- /dev/null +++ b/apkovl/etc/runlevels/default/megabit @@ -0,0 +1 @@ +/etc/init.d/megabit \ No newline at end of file diff --git a/apkovl/etc/runlevels/default/megabit-sync b/apkovl/etc/runlevels/default/megabit-sync new file mode 120000 index 0000000..e38d827 --- /dev/null +++ b/apkovl/etc/runlevels/default/megabit-sync @@ -0,0 +1 @@ +/etc/init.d/megabit-sync \ No newline at end of file diff --git a/apkovl/usr/local/bin/megabit b/apkovl/usr/local/bin/megabit new file mode 100755 index 0000000..1e20220 --- /dev/null +++ b/apkovl/usr/local/bin/megabit @@ -0,0 +1,4 @@ +#!/bin/sh +export NODE_PATH=$(npm root -g) +nodemon --delay 1 --watch /tmp --signal SIGTERM --exec 'node /tmp/index.js || true' & +echo $! > /var/run/megabit.pid diff --git a/apkovl/usr/local/bin/megabit-sync b/apkovl/usr/local/bin/megabit-sync new file mode 100755 index 0000000..9aa4cc3 --- /dev/null +++ b/apkovl/usr/local/bin/megabit-sync @@ -0,0 +1,3 @@ +#!/bin/sh +nodemon --delay 1 --watch /usr/share/megabit/tmp.img --signal SIGTERM --exec 'umount /mnt/tmp; mount /usr/share/megabit/tmp.img /mnt/tmp; rsync -a --delete --exclude=node_modules/ /mnt/tmp/ /tmp/' & +echo $! > /var/run/megabit-sync.pid diff --git a/docker-compose.yml b/docker-compose.yml index f59e17d..449b09f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,9 @@ services: - ./dist/overlay.img:/overlay.img privileged: true command: | - sh -c ' - mount -a \ - && apk add g++ linux-headers make nodejs npm python3 + sh -exc ' + mkdir -p /mnt/overlay + mount -a + apk add g++ linux-headers make nodejs npm python3 + npm install -g megabit nodemon ' diff --git a/fstab b/fstab index 5618065..9e9d56c 100644 --- a/fstab +++ b/fstab @@ -1,2 +1,2 @@ -/overlay.img /mnt ext4 rw,relatime,errors=remount-ro 0 0 -overlay /usr overlay lowerdir=/usr,upperdir=/mnt/upper/usr,workdir=/mnt/work/usr 0 0 +/overlay.img /mnt/overlay ext4 rw,relatime,errors=remount-ro 0 0 +overlay /usr overlay lowerdir=/usr,upperdir=/mnt/overlay/upper/usr,workdir=/mnt/overlay/work/usr 0 0 diff --git a/overlay.img.gz b/overlay.img.gz index 1b6992b..84846ef 100644 Binary files a/overlay.img.gz and b/overlay.img.gz differ