init(00_tmp): idempotent mkdir -p, drop rm that failed on fresh boot

This commit is contained in:
Red Bear OS
2026-07-16 18:57:53 +09:00
parent f5f726ca1e
commit c14a577dc8
+10 -4
View File
@@ -1,4 +1,10 @@
# FIXME change this to a service unit
# clear and recreate tmpdir with 0o1777 permission
rm -rf /tmp
mkdir -m a=rwxt /tmp
# Ensure the tmpdir exists with sticky 0o1777 permission.
#
# init runs each line as a standalone Oneshot command (no shell), so we cannot
# `rm -rf /tmp || true`. The previous `rm -rf /tmp` followed by a bare
# `mkdir /tmp` broke on a fresh boot: Redox's uutils `rm -f` errors on a
# missing operand ("cannot remove '/tmp': No such file or directory") — which
# POSIX says -f must ignore — and the subsequent non-`-p` mkdir then errors if
# /tmp already exists. A live boot has a fresh ramfs /tmp with nothing to
# clean, so just create it idempotently; `mkdir -p` is a no-op when present.
mkdir -p -m a=rwxt /tmp