mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge remote-tracking branch 'origin/unstable' into unstable
This commit is contained in:
commit
48816b374e
2 changed files with 11 additions and 7 deletions
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
# Generate a random password
|
|
||||||
#
|
|
||||||
# usage: ynh_password
|
|
||||||
ynh_password() {
|
|
||||||
echo $(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
|
||||||
}
|
|
11
data/apps/helpers.d/string
Normal file
11
data/apps/helpers.d/string
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Generate a random string
|
||||||
|
#
|
||||||
|
# example: pwd=$(ynh_string_random 8)
|
||||||
|
#
|
||||||
|
# usage: ynh_string_random [length]
|
||||||
|
# | arg: length - the string length to generate (default: 24)
|
||||||
|
ynh_string_random() {
|
||||||
|
dd if=/dev/urandom bs=1 count=200 2> /dev/null \
|
||||||
|
| tr -c -d '[A-Za-z0-9]' \
|
||||||
|
| sed -n 's/\(.\{'"${1:-24}"'\}\).*/\1/p'
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue