mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add a helper to create a directory under /tmp
This commit is contained in:
parent
a9046a7200
commit
6840d120c0
1 changed files with 12 additions and 0 deletions
|
@ -27,3 +27,15 @@ ynh_bind_or_cp() {
|
||||||
fi
|
fi
|
||||||
$SUDO_CMD cp -r "$SRCDIR" "$DESTDIR"
|
$SUDO_CMD cp -r "$SRCDIR" "$DESTDIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create a directory under /tmp
|
||||||
|
#
|
||||||
|
# usage: ynh_mkdir_tmp
|
||||||
|
# | ret: the created directory path
|
||||||
|
ynh_mkdir_tmp() {
|
||||||
|
TMPDIR="/tmp/$(ynh_string_random 6)"
|
||||||
|
while [ -d $TMPDIR ]; do
|
||||||
|
TMPDIR="/tmp/$(ynh_string_random 6)"
|
||||||
|
done
|
||||||
|
mkdir -p "$TMPDIR" && echo "$TMPDIR"
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue