a yum_install function
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 23 Mar 2011 14:19:28 +0000 (15:19 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 23 Mar 2011 14:19:28 +0000 (15:19 +0100)
sliver-initscripts/initscript-template.sh

index 5b12e6f..72c8d59 100644 (file)
@@ -5,12 +5,27 @@ slicename=$1; shift
 # that can make sense if needed
 # source /etc/init.d/functions
 
+# a reasonably tested function for installing with yum
+function yum_install () {
+    pkg="$1"; shift
+    while true; do
+       rpm -q $pkg && break
+       sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY 
+       sudo yum -y install $pkg
+       sleep 10
+    done
+    echo $pkg installed
+}
+
+####################
 function start () {
     
 }
 function stop () {
 
 }
+
+####################
 function restart () {
   stop
   start