mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Flesh out tool/zsh/mkofs
It now prevents double-mounting. Also adds vim filetype modelines.
This commit is contained in:
parent
16099801cc
commit
cafea9a0a5
3 changed files with 26 additions and 1 deletions
|
@ -1 +1,24 @@
|
|||
sudo mount -t tmpfs -o size=10G,noatime,nodiratime /dev/shm ${COSMO:-$PWD}/o
|
||||
[[ -f /proc/mounts ]] || {
|
||||
echo "mkofs: only supported on linux" >&2
|
||||
return 1
|
||||
}
|
||||
local o
|
||||
if [[ -d "$PWD/o" ]]; then
|
||||
o=$PWD/o
|
||||
elif [[ -n "$COSMO" && -d "$COSMO/o" ]]; then
|
||||
o=$COSMO/o
|
||||
else
|
||||
echo "mkofs: o/ not found" >&2
|
||||
return 1
|
||||
fi
|
||||
o=$(realpath "$o")
|
||||
cut -d' ' -f2 /proc/mounts | while read -r line; do
|
||||
if [[ "$o" = "$line" ]]; then
|
||||
echo "mkofs: $o already mounted" >&2
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
( set -x
|
||||
sudo mount -t tmpfs -o size=10G,noatime,nodiratime /dev/shm "$o"
|
||||
)
|
||||
# vim:ft=zsh
|
||||
|
|
|
@ -42,3 +42,4 @@ local make=${MAKE:-${COSMOCC:-/opt/cosmocc/current}/bin/make}
|
|||
[[ -x $make ]] || make=${COSMO:-$PWD}/build/bootstrap/make.com
|
||||
( set -x
|
||||
exec $make $j $flags MODE=$mode $targs )
|
||||
# vim:ft=zsh
|
||||
|
|
|
@ -16,3 +16,4 @@ nproc() {
|
|||
echo 2
|
||||
}
|
||||
nproc
|
||||
# vim:ft=zsh
|
||||
|
|
Loading…
Reference in a new issue