Personal tools
     DOCUMENTATION

Appliance:etcissueInitScript

From rPath Wiki

Jump to: navigation, search

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

You can customize your appliance merely by creating the files /etc/sysconfig/appliance-name and /etc/sysconfig/appliance-group in any package included in your appliance, without modifying either the distro-releasee or distro-conary-config packages. For further customization, rebuilding the distro-release package is now much simpler than it was previously.

The new distro-release init script reads the appliance name from the /etc/sysconfig/appliance-name file (if that file does not exist, the default is "rPath Linux"), and the Conary group to query for version information from the /etc/sysconfig/appliance-group file (the default is the top-level group, if only one exists, or no version information otherwise). It then appropriately modifies the /etc/issue, /etc/issue.net, and /etc/distro-release files.


#! /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 "APPLIANCE NAME AND VERSION" > /etc/issue
    echo "Powered by rPath Linux" >> /etc/issue
    echo " " >> /etc/issue
    netcount=$(/sbin/ifconfig | grep -o "inet")
    if [[ $netcount > 1 ]]
    then
       #
       #THIS SHOULD INDICATE THE URL OF YOUR APPLICATION IF APPLICABLE.  IF THERE IS NO WEB INTERFACE,
       #THIS SECTION SHOULD BE COMMENTED OUT.
       #
       echo "To use this appliance, please use a web browser" >> /etc/issue
       echo "from another system to navigate to " >> /etc/issue
       echo " " >> /etc/issue
       /sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print "http://"$2"/" }' >> /etc/issue
       echo " " >> /etc/issue
       #
       #THIS INDICATES THE LINK TO THE RPATH APPLIANCE AGENT INTERFACE.  IF YOUR APPLIANCE DOES NOT USE 
       #RAA THIS SHOULD BE COMMENTED OUT.
       #
       echo "To manage the configuration of this appliance, please use" >> /etc/issue
       echo "a web browser from another system to navigate to " >> /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/rAA" }' >> /etc/issue
       echo " " >> /etc/issue
       echo "rAA Username:  Admin" >> /etc/issue
       echo "rAA Password:  Password" >> /etc/issue
    else
       echo "This appliance does not have networking configured.  Please log in to configure networking" >> /etc/issue
    fi
    echo " " >> /etc/issue
    #
    #Input a link to an external website to reference
    #
    echo "For more information regarding this appliance, please visit" >> /etc/issue
    echo " " >> /etc/issue
    echo "URL OF YOUR EXTERNAL WEBSITE" >> /etc/issue
    echo " " >> /etc/issue
    cp /etc/issue /etc/issue.net
       RETVAL=$?
 echo  
 [ $RETVAL -eq 0 ]   
 return $RETVAL
 }
case "$1" in
 start)
   start
 ;;
 *)
 echo $"Usage: $0 {start}"
 exit 1
esac
exit $?