#!/bin/sh # # add-rc.local # # add the following lines to /etc/rc.local # # if [ -f $(SERVERDIR)/skkserv ]; then # $(SERVERDIR)/skkserv; # fi # # You can do it by hand. If you want so, answer 'no' to the question. # will not check if I am "root" #USER=`whoami` #if test $USER != "root" #then # echo "You are not a superuser !" # exit 1 #fi if test "xx"$1 = "xx" then echo "Usage: sh add-rc.local server-program" exit 1 fi if [ ! -f $1 ]; then echo "The server program \"$1\" does not exist !" exit 1 fi if sed -e "/^#/d" /etc/rc.local | grep skkserv; then echo "It seems that \"skkserv\" already exists in \"/etc/rc.local\"." echo "You should check if \"skkserv\" will be invoked at system-starting up." else echo "Do you really want me to add several lines into \"/etc/rc.local\" [yes or no] ?" read ans case $ans in y*) cp /etc/rc.local /etc/rc.local.org chmod +w /etc/rc.local echo "# skk jisyo server" >> /etc/rc.local echo "if [ -f $1 ]; then" >> /etc/rc.local echo " $1;" >> /etc/rc.local echo "fi" >> /etc/rc.local echo "Adding several lines to \"/etc/rc.local\" DONE!" echo "The original file was saved as \"/etc/rc.local.org\"." ;; *) echo "O.K. You should set it by yourself, if you want \"skkserv\" to run automatically." ;; esac fi