summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnjay <johnjay@localhost>2006-08-14 23:33:12 +0000
committerjohnjay <johnjay@localhost>2006-08-14 23:33:12 +0000
commitf9de55f6864c5b2c346a9676b3ee3923d5fc6e98 (patch)
tree7d6fad46a89453118a64dfede1b6329489b46cb8
parentdev-db/psqlodbc: Setting version for libiodbc dependency to 3.52.4, thanks to... (diff)
downloadexperimental-f9de55f6864c5b2c346a9676b3ee3923d5fc6e98.tar.gz
experimental-f9de55f6864c5b2c346a9676b3ee3923d5fc6e98.tar.bz2
experimental-f9de55f6864c5b2c346a9676b3ee3923d5fc6e98.zip
eclass/einput: Added add_init_prompt to help streamlien init-script addition
svn path=/experimental/; revision=80
-rw-r--r--eclass/einput.eclass26
1 files changed, 26 insertions, 0 deletions
diff --git a/eclass/einput.eclass b/eclass/einput.eclass
index 136e7dc..5cc113e 100644
--- a/eclass/einput.eclass
+++ b/eclass/einput.eclass
@@ -258,3 +258,29 @@ einput_multi_prompt() {
EINPUT_ANSWER="$answer"
EINPUT_IANSWER=`echo -n ${EINPUT_ANSWER} | tr [:upper:] [:lower:]`
}
+
+# Usage: einput_add_init prompt
+#
+# Displays a simple predefined prompt with the package name ($1) asking if
+# a packages init script should be added to the $2 runlevel. If an init
+# script already exists, no prompt will be shown and the function will return
+# 0.
+#
+# Returns: The exit code from rc-update if an existing entry does not exist.
+# If an existing entry exists, returns 0.
+# Default: none
+#
+# Example: einput_add_init "postgresql" "default"
+#
+einput_add_init() {
+ check_if_exists=`${ROOT}/sbin/rc-update show $2 | grep $1 | wc -l`
+ if [ "${check_if_exists}" == "0" ]; then
+ if einput_confirm "Do you want to add $1 to your default runlevel?" "0";
+ then
+ ${ROOT}/sbin/rc-update add $1 $2
+ return $?
+ fi
+ else
+ return 0
+ fi
+}