5 커밋
1.7.3 ... 1.8.1

작성자 SHA1 메시지 날짜
fbt
c0364011e0 Use an indexed array for mount definitions 2015-08-26 14:44:08 +03:00
fbt
f93cfc9056 git you silly thing 2015-08-17 17:13:39 +03:00
fbt
e59c449b0e Merge branch 'master' of builder:git/spark-rc 2015-08-17 17:10:28 +03:00
fbt
90c8943782 create the default XDG_RUNTIME dirs 2015-08-17 17:10:19 +03:00
fbt
33cea83d1b sync 2015-08-08 19:38:56 +03:00
6개의 변경된 파일72개의 추가작업 그리고 17개의 파일을 삭제

파일 보기

@@ -3,15 +3,19 @@
# Please modify config.mk and not this
sinclude config.mk
.PHONY: clean install uninstall all
.PHONY: clean install uninstall all tools
build: rc
build: rc tools
all: build
tools:
make -C tools
rc: rc.in
sed -r \
-e 's%@ETC@%$(ETC)%' \
-e 's%@BASH_PATH@%$(BASH_PATH)%' \
rc.in > rc
chmod 750 $@
@@ -19,6 +23,8 @@ rc: rc.in
clean:
rm rc
make -C tools clean
install: build
install -dm755 $(BINDIR)
install -dm755 $(ETCDIR)
@@ -29,5 +35,9 @@ install: build
install -m755 tools/killall5 $(BINDIR)/killall5
make -C tools install
uninstall:
rm $(BINDIR)/rc
make -C tools uninstall

파일 보기

@@ -4,5 +4,7 @@ USR ?= /usr/local
ETC ?= /etc
BIN ?= $(USR)/bin
BASH_PATH ?= /bin/bash
BINDIR = $(DESTDIR)$(PREFIX)$(BIN)
ETCDIR = $(DESTDIR)$(PREFIX)$(ETC)

파일 보기

@@ -9,8 +9,8 @@ cfg_hostname='changeme'
#cfg_timezone='Europe/Moscow'
# Services
cfg_services+=( 'fsck' 'mount' 'systemd-udevd' 'sysctl' ) # Services that need tp be started in an order
cfg_services+=( '@lo.iface' ) # These start in parallel.
cfg_services+=( 'fsck' 'mount' 'sysctl' 'rsyslogd' ) # Services that need tp be started in an order
cfg_services+=( '@lo.iface' '@scron' '@sshd' ) # These start in parallel.
cfg_services+=( @agetty-tty{2..6} ) # Comment this if your init starts something on the ttys itself.
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last. Technically here it doesn't. Not quite :)

38
rc.in Executable file → Normal file
파일 보기

@@ -1,15 +1,16 @@
#!/bin/bash
#!@BASH_PATH@
declare -A cfg_mounts
# Default virtual mounts for linux systems
cfg_mounts+=( 'proc:proc:/proc:' )
cfg_mounts+=( 'run:tmpfs:/run:' )
cfg_mounts+=( 'sys:sysfs:/sys:' )
cfg_mounts[proc]='proc:/proc'
cfg_mounts[run]='tmpfs:/run'
cfg_mounts[sys]='sysfs:/sys'
# devfs and its children
cfg_mounts+=( 'dev:devtmpfs:/dev:' )
cfg_mounts+=( 'pts:devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620' )
cfg_mounts+=( 'mqueue:mqueue:/dev/mqueue:noexec,nosuid,nodev' )
cfg_mounts+=( 'shm:tmpfs:/dev/shm:defaults,mode=0777' )
cfg_mounts[dev]='devtmpfs:/dev'
cfg_mounts[pts]='devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620'
cfg_mounts[mqueue]='mqueue:/dev/mqueue:noexec,nosuid,nodev'
cfg_mounts[shm]='tmpfs:/dev/shm:defaults,mode=0777'
# Some temporary directories
cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
@@ -17,6 +18,14 @@ cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
# And temporary files
cfg_tmpfiles+=( '/run/utmp' )
# Default XDG_RUNTIME_DIR for all non-system users
# rtkit:x:133:133:RealtimeKit:/proc:/sbin/nologin
while IFS=':' read -r _ _ uid gid _; do
if (( uid >= 1000 )); then
cfg_tmpdirs+=( "/run/user/$uid:700:$uid:$gid" )
fi
done < /etc/passwd
# Functions
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
@@ -32,7 +41,8 @@ rc.motd() {
rc.tmpfiles() {
printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm own grp; do
install -v -d -m "${perm:-755}" -o "${own:-root}" -g "${grp:-root}" "$dir" 2>/dev/null
mkdir -pm "${perm:-755}" "$dir"
chown -c "${own:-root}:${grp:-root}" "$dir"
done
printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm own grp; do
@@ -43,8 +53,8 @@ rc.tmpfiles() {
}
rc.mount_misc() {
for m in "${cfg_mounts[@]}"; do
echo "$m" | while IFS=':' read fs fs_type mountpoint mount_options; do
for fs in "${!cfg_mounts[@]}"; do
echo "$fs" | while IFS=':' read fs_type mountpoint mount_options; do
[[ "$mount_options" ]] || { mount_options='defaults'; }
mountpoint -q "$mountpoint" || {
@@ -142,10 +152,14 @@ rc.halt() {
esac
}
rc.sync() {
echo "Syncing disks."
}
rc.shutdown() {
rc.services_stop
rc.stop_everything
sync
rc.sync
rc.unmount_everything
rc.remount_root

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
파일 보기

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!@BASH_PATH@
# A simple reimplementation of killall5 from sysvinit-tools
get_my_tree() {