aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xget-password21
-rw-r--r--rpm-helper.macros.in4
2 files changed, 25 insertions, 0 deletions
diff --git a/get-password b/get-password
new file mode 100755
index 0000000..27cca4d
--- /dev/null
+++ b/get-password
@@ -0,0 +1,21 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : get-password
+# Version : $Id: del-user,v 1.1.1.1 2002/07/09 15:04:21 flepied Exp $
+# Author : Guillaume Rousse
+# Created On : Thu Apr 1 00:00:46 2004
+# Purpose : helper script for rpm scriptlets to generate
+# a random password
+#---------------------------------------------------------------
+
+if [ -n "$1" ]; then
+ length=$1
+else
+ length=8
+fi
+
+perl -e "print map { (a..z,A..Z,0..9)[rand 62] } 0..$length"
+
+# get-password ends here
diff --git a/rpm-helper.macros.in b/rpm-helper.macros.in
index b33de40..37e7d7e 100644
--- a/rpm-helper.macros.in
+++ b/rpm-helper.macros.in
@@ -1,5 +1,9 @@
# $Id$
+%_get_password_helper @LIBDIR@/get-password
+%get_password() %_get_password_helper %{1} \
+%{nil}
+
%_create_ghostfile_helper @LIBDIR@/create-file
%create_ghostfile() %_create_ghostfile_helper %{name} $1 %{1} %{2} %{3} %{4} \
%{nil}