Skip to content

Commit

Permalink
mkofs improvements
Browse files Browse the repository at this point in the history
- Always use $PWD/o. if it doesn't exist, say how to create it.

- return 2 on unsupported platforms.
  • Loading branch information
mrdomino committed Jan 8, 2024
1 parent b580080 commit 6cb0354
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tool/zsh/mkofs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[[ -f /proc/mounts ]] || {
echo "mkofs: only supported on linux" >&2
return 1
return 2
}
local o
if [[ -d "$PWD/o" ]]; then
o=$PWD/o
elif [[ -n "$COSMO" && -d "$COSMO/o" ]]; then
o=$COSMO/o
if [[ -d o ]]; then
o=$(pwd -P)/o
else
echo "mkofs: o/ not found" >&2
echo "suggested preparation:" >&2
echo " mkdir -m 555 o" >&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
Expand Down

0 comments on commit 6cb0354

Please sign in to comment.