- 論壇徽章:
- 0
|
#!/bin/bash
#
# firstboot: Starts the firstboot druid if it hasn't been run before
#
# chkconfig: 35 95 95
#
# description: Firstboot is a druid style program that runs on the first time \
# a machine is booted after install. It checks for the existence \
# of an /etc/sysconfig/firstboot file. If it doesn't find the file, \
# then the firstboot program needs to run. If it finds the file, \
# firstboot will not be run.
# If /etc/reconfigSys exists, run the reconfiguration
# program and remove /etc/reconfigSys when done.
#
# Also will run if 'reconfig' is on the kernel cmdline.
#
unset LC_MESSAGES
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="`/sbin/consoletype`"
export LANG
# Source function library.
. /etc/init.d/functions
FILENAME=/etc/sysconfig/firstboot
LOCKFILE=/var/lock/subsys/firstboot
[ -z "$HOME" ] && export HOME=/
case "$1" in
start)
action=run
[ -f "$LOCKFILE" ] && exit 0
if [ -f "$FILENAME" ] && ! grep -q '^RUN_FIRSTBOOT=YES' "$FILENAME"; then
action=skip
fi
if grep -i reconfig /proc/cmdline >/dev/null || [ -f /etc/reconfigSys ]; then
action=reconfig
fi
[ $action = skip ] && exit 0
runlevel=$(set -- $(runlevel); eval "echo \$$#" )
if grep -q "^id:5:initdefault:" /etc/inittab && [ "x$runlevel" = x5 ]; then
if [ ! -f /etc/X11/xorg.conf -a ! -f /etc/X11/XF86Config ] ; then
echo -n $"X is not configured. Running system-config-display"
/usr/bin/system-config-display
echo -n $"X is now configured. Starting Setup Agent"
fi
fi
if [ $action = reconfig ]; then
echo -n $"Running system reconfiguration tool"
/usr/sbin/firstboot --reconfig
rm -f /etc/reconfigSys
exit 0
fi
touch $LOCKFILE
/usr/sbin/firstboot
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
action "" /bin/true
else
action "" /bin/false
fi
exit 0
;;
stop)
rm -f $LOCKFILE
;;
esac
exit $RETVAL
這個(gè)是/etc/init.d/firstboot的腳本,這個(gè)程序在安裝完linux之后第一次登錄的時(shí)候會(huì)運(yùn)行,這個(gè)程序也是圖形界面的,也就是說(shuō)它應(yīng)該啟動(dòng)了圖形界面需要的東西,所以我想從這段代碼中取出啟動(dòng)圖形界面的東西,然后加上我的程序的絕對(duì)路徑,就應(yīng)該可以運(yùn)行了,但是我做昨天嘗試的代碼是這樣的:
if [ ! -f /etc/X11/xorg.conf -a ! -f /etc/X11/XF86Config ] ; then
echo -n $"X is not configured. Running system-config-display"
/usr/bin/system-config-display
echo -n $"X is now configured. Starting Setup Agent"
fi
/lianxy/shell_test/windowsproject
這段代碼執(zhí)行后,啟動(dòng)的時(shí)候就像死機(jī)一樣,不懂了,ssh訪問(wèn)也特別慢,好像有什么占用了所有的cpu或者內(nèi)存
不知道這個(gè)能不能有什么用,請(qǐng)指點(diǎn)
[ 本帖最后由 艾因思念 于 2006-7-27 10:10 編輯 ] |
|