diff --git a/bin/yunohost b/bin/yunohost index a5fadf574..3f947364b 100755 --- a/bin/yunohost +++ b/bin/yunohost @@ -66,6 +66,10 @@ def _parse_cli_args(): action='store_true', default=False, help="Don't produce any output", ) + parser.add_argument('--admin-password', + default=None, dest='password', metavar='PASSWORD', + help="The admin password to use to authenticate", + ) # deprecated arguments parser.add_argument('--plain', action='store_true', default=False, help=argparse.SUPPRESS @@ -199,6 +203,6 @@ if __name__ == '__main__': from moulinette import cli ret = cli(_retrieve_namespaces(), args, use_cache=opts.use_cache, output_as=opts.output_as, - parser_kwargs={'top_parser': parser} + password=opts.password, parser_kwargs={'top_parser': parser} ) sys.exit(ret) diff --git a/data/apps/helpers.d/filesystem b/data/apps/helpers.d/filesystem index c3332a794..087a9e944 100644 --- a/data/apps/helpers.d/filesystem +++ b/data/apps/helpers.d/filesystem @@ -27,3 +27,15 @@ ynh_bind_or_cp() { fi $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" +} diff --git a/data/apps/helpers.d/setting b/data/apps/helpers.d/setting new file mode 100644 index 000000000..14d47c133 --- /dev/null +++ b/data/apps/helpers.d/setting @@ -0,0 +1,18 @@ +# Get an application setting +# +# usage: ynh_app_setting_get app key +# | arg: app - the application id +# | arg: key - the setting to get +ynh_app_setting_get() { + sudo yunohost app setting "$1" "$2" --output-as plain +} + +# Set an application setting +# +# usage: ynh_app_setting_set app key value +# | arg: app - the application id +# | arg: key - the setting name to set +# | arg: value - the setting value to set +ynh_app_setting_set() { + sudo yunohost app setting "$1" "$2" -v "$3" +}