Make use of a /etc/conf.d/tmpfs file to setup /tmp mounting, instead of relying on deviceinfo_tmp_as_tmpfs_size. This matches what is currently being done in systemd (where we also do tmp config at the init system level). Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8737>
27 lines
671 B
Plaintext
27 lines
671 B
Plaintext
#!/sbin/openrc-run
|
|
|
|
depend() {
|
|
need localmount
|
|
after swapfile
|
|
before bootmisc
|
|
}
|
|
|
|
start() {
|
|
if [ "$tmpfs_size" = "0" ]; then
|
|
return 0
|
|
fi
|
|
|
|
_mem_size_mb="$(LC_ALL=C free -m | awk '/^Mem:/{print $2}')"
|
|
# Mount if asked to, or if we have more than 2GB of memory,
|
|
# but never if already mounted
|
|
if [ -n "$tmpfs_size" ] || \
|
|
[ $_mem_size_mb -ge 2048 ] && \
|
|
! mountinfo -q -f tmpfs /tmp ; then
|
|
ebegin "Mounting /tmp as tmpfs"
|
|
mkdir -p /tmp || { eend 1 "Failed to create /tmp" ; return 1 ; }
|
|
# mount params taken from Debian buster
|
|
mount -t tmpfs -o mode=1777,strictatime,nosuid,nodev,size="${tmpfs_size:-50%}",nr_inodes=400k tmpfs /tmp
|
|
eend $?
|
|
fi
|
|
}
|