Use an indexed array for mount definitions
This commit is contained in:
parent
f93cfc9056
commit
c0364011e0
14
Makefile
14
Makefile
|
@ -3,15 +3,19 @@
|
||||||
# Please modify config.mk and not this
|
# Please modify config.mk and not this
|
||||||
sinclude config.mk
|
sinclude config.mk
|
||||||
|
|
||||||
.PHONY: clean install uninstall all
|
.PHONY: clean install uninstall all tools
|
||||||
|
|
||||||
build: rc
|
build: rc tools
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
|
tools:
|
||||||
|
make -C tools
|
||||||
|
|
||||||
rc: rc.in
|
rc: rc.in
|
||||||
sed -r \
|
sed -r \
|
||||||
-e 's%@ETC@%$(ETC)%' \
|
-e 's%@ETC@%$(ETC)%' \
|
||||||
|
-e 's%@BASH_PATH@%$(BASH_PATH)%' \
|
||||||
rc.in > rc
|
rc.in > rc
|
||||||
|
|
||||||
chmod 750 $@
|
chmod 750 $@
|
||||||
|
@ -19,6 +23,8 @@ rc: rc.in
|
||||||
clean:
|
clean:
|
||||||
rm rc
|
rm rc
|
||||||
|
|
||||||
|
make -C tools clean
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
install -dm755 $(BINDIR)
|
install -dm755 $(BINDIR)
|
||||||
install -dm755 $(ETCDIR)
|
install -dm755 $(ETCDIR)
|
||||||
|
@ -29,5 +35,9 @@ install: build
|
||||||
|
|
||||||
install -m755 tools/killall5 $(BINDIR)/killall5
|
install -m755 tools/killall5 $(BINDIR)/killall5
|
||||||
|
|
||||||
|
make -C tools install
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm $(BINDIR)/rc
|
rm $(BINDIR)/rc
|
||||||
|
|
||||||
|
make -C tools uninstall
|
||||||
|
|
|
@ -4,5 +4,7 @@ USR ?= /usr/local
|
||||||
ETC ?= /etc
|
ETC ?= /etc
|
||||||
BIN ?= $(USR)/bin
|
BIN ?= $(USR)/bin
|
||||||
|
|
||||||
|
BASH_PATH ?= /bin/bash
|
||||||
|
|
||||||
BINDIR = $(DESTDIR)$(PREFIX)$(BIN)
|
BINDIR = $(DESTDIR)$(PREFIX)$(BIN)
|
||||||
ETCDIR = $(DESTDIR)$(PREFIX)$(ETC)
|
ETCDIR = $(DESTDIR)$(PREFIX)$(ETC)
|
||||||
|
|
21
rc.in
21
rc.in
|
@ -1,15 +1,16 @@
|
||||||
#!/bin/bash
|
#!@BASH_PATH@
|
||||||
|
declare -A cfg_mounts
|
||||||
|
|
||||||
# Default virtual mounts for linux systems
|
# Default virtual mounts for linux systems
|
||||||
cfg_mounts+=( 'proc:proc:/proc:' )
|
cfg_mounts[proc]='proc:/proc'
|
||||||
cfg_mounts+=( 'run:tmpfs:/run:' )
|
cfg_mounts[run]='tmpfs:/run'
|
||||||
cfg_mounts+=( 'sys:sysfs:/sys:' )
|
cfg_mounts[sys]='sysfs:/sys'
|
||||||
|
|
||||||
# devfs and its children
|
# devfs and its children
|
||||||
cfg_mounts+=( 'dev:devtmpfs:/dev:' )
|
cfg_mounts[dev]='devtmpfs:/dev'
|
||||||
cfg_mounts+=( 'pts:devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620' )
|
cfg_mounts[pts]='devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620'
|
||||||
cfg_mounts+=( 'mqueue:mqueue:/dev/mqueue:noexec,nosuid,nodev' )
|
cfg_mounts[mqueue]='mqueue:/dev/mqueue:noexec,nosuid,nodev'
|
||||||
cfg_mounts+=( 'shm:tmpfs:/dev/shm:defaults,mode=0777' )
|
cfg_mounts[shm]='tmpfs:/dev/shm:defaults,mode=0777'
|
||||||
|
|
||||||
# Some temporary directories
|
# Some temporary directories
|
||||||
cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
|
cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
|
||||||
|
@ -52,8 +53,8 @@ rc.tmpfiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.mount_misc() {
|
rc.mount_misc() {
|
||||||
for m in "${cfg_mounts[@]}"; do
|
for fs in "${!cfg_mounts[@]}"; do
|
||||||
echo "$m" | while IFS=':' read fs fs_type mountpoint mount_options; do
|
echo "$fs" | while IFS=':' read fs_type mountpoint mount_options; do
|
||||||
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
||||||
|
|
||||||
mountpoint -q "$mountpoint" || {
|
mountpoint -q "$mountpoint" || {
|
||||||
|
|
29
tools/Makefile
Normal file
29
tools/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# spark-rc tools makefile
|
||||||
|
|
||||||
|
# Please modify config.mk and not this
|
||||||
|
sinclude ../config.mk
|
||||||
|
|
||||||
|
.PHONY: clean install uninstall all
|
||||||
|
|
||||||
|
build: killall5
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
killall5: killall5.in
|
||||||
|
sed -r \
|
||||||
|
-e 's%@BASH_PATH@%$(BASH_PATH)%' \
|
||||||
|
killall5.in > killall5
|
||||||
|
|
||||||
|
chmod 750 $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm killall5
|
||||||
|
|
||||||
|
install: build
|
||||||
|
install -dm755 $(BINDIR)
|
||||||
|
install -dm755 $(ETCDIR)
|
||||||
|
|
||||||
|
install -m750 killall5 $(BINDIR)/killall5
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm $(BINDIR)/killall5
|
2
tools/killall5 → tools/killall5.in
Executable file → Normal file
2
tools/killall5 → tools/killall5.in
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!@BASH_PATH@
|
||||||
# A simple reimplementation of killall5 from sysvinit-tools
|
# A simple reimplementation of killall5 from sysvinit-tools
|
||||||
|
|
||||||
get_my_tree() {
|
get_my_tree() {
|
Loading…
Reference in New Issue
Block a user