Personal tools
     DOCUMENTATION

example-appliance.issue

From rPath Wiki

Jump to: navigation, search
This Page has been Archived
This page has been flagged as containing information that is no longer applicable to recent versions of the product.

This script is preserved for historical context. The distro-release package now includes a distro-release init script.

The following is an example appliance.issue file. Customize the areas surrounded by "***" as needed.

 
#! /bin/bash
#
# issue-reset                    set ipaddr in /etc/issue
#
# chkconfig: 2345 90 60
# description: this will echo the ip address to /etc/issue for display
 
# Source function library.
. /etc/init.d/functions
 
RETVAL=0
 
# See how we were called.
 
prog="issue-reset"
 
start() {
#change /etc/issue to display ip address
    echo "***INSERT APPLIANCE INFORMATION HERE***" > /etc/issue
    echo "Powered by rPath Linux" >> /etc/issue
    netcount=$(/sbin/ifconfig | grep -o "inet")
 
    if [[ $netcount > 1 ]]
    then
 
    echo " "
        echo "Use a web browser to administer this appliance at this URL:" >> /etc/issue
        echo " " >> /etc/issue
 
        /sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print "https://"$2":8003/" }' >> /etc/issue
        echo " " >> /etc/issue
    else
        echo "This appliance does not have networking configured. Please log in to configure networking." >> /etc/issue
    fi
 
    echo " " >> /etc/issue
    echo "For more information regarding this appliance, please visit" >> /etc/issue
    echo " " >> /etc/issue
    echo "***http://example.com/***" >> /etc/issue
    echo " " >> /etc/issue
    cp /etc/issue /etc/issue.net
       RETVAL=$?
 echo
 [ $RETVAL -eq 0 ]
 return $RETVAL
}
 
case "$1" in
 start)
   start
 ;;
 status)
 ;;
 stop)
 ;;
 *)
 echo $"Usage: $0 {start}"
 exit 1
esac
 
exit $?