剛手賤...(不小心把/etc/init.d/xdm給幹掉了)

有關於X 環境當中所遇到的問題

Moderator: Forums Team

Post Reply
funal
Posts: 40
Joined: Sat Apr 03, 2004 6:24 pm

剛手賤...(不小心把/etc/init.d/xdm給幹掉了)

Post by funal »

不小心把/etc/init.d/xdm這個檔給幹掉了...
死了..要emerge那一個套件啊??xfree嗎??

謝謝
Last edited by funal on Wed Apr 14, 2004 9:25 am, edited 1 time in total.
User avatar
【Palatis】
Posts: 956
Joined: Wed Apr 02, 2003 4:21 pm
Location: 偶爾插花...</br>亞利安星球
Contact:

Post by 【Palatis】 »

Code: Select all

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/x11-base/xfree/files/4.3.0/xdm.start,v 1.4 2004/03/06 04:20:10 vapier Exp $

# This is here to serve as a note to myself, and future developers.
#
# Any Display manager (gdm,kdm,xdm) have the following problem:  if
# it is started before any getty, and no vt is specified, it will
# usually run on vt2.  When the getty on vt2 then starts, and the
# DM is already started, the getty will take control of the keyboard,
# leaving us with a "dead" keyboard.
#
# Resolution: add the following line to /etc/inittab
#
#  x:a:once:/etc/X11/startDM.sh
#
# and have /etc/X11/startDM.sh start the DM in daemon mode if
# a lock is present (with the info of what DM should be started),
# else just fall through.
#
# How this basically works, is the "a" runlevel is a additional
# runlevel that you can use to fork processes with init, but the
# runlevel never gets changed to this runlevel.  Along with the "a"
# runlevel, the "once" key word means that startDM.sh will only be
# run when we specify it to run, thus eliminating respawning
# startDM.sh when "xdm" is not added to the default runleve, as was
# done previously.
#
# This script then just calls "tellinit a", and init will run
# /etc/X11/startDM.sh after the current runlevel completes (this
# script should only be added to the actual runlevel the user is
# using).
#
# Martin Schlemmer
# aka Azarah
# 04 March 2002


# Start X Font Server before X
depend() {
        use xfs hotplug
}

setup_dm() {
        source /etc/profile.env
        export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"

        case "$(echo ${DISPLAYMANAGER} | awk '{ print toupper($1) }')" in
                KDM|KDE|KDE2|KDE3)
                        EXE="$(which kdm)"
                        ;;
                ENTRANCE*)
                        EXE="$(which entranced)"
                        ;;
                GDM|GNOME)
                        EXE=/usr/bin/gdm
                        ;;
                WDM)
                        EXE=/usr/bin/wdm
                        ;;              
                *)
                        EXE=/usr/X11R6/bin/xdm
                        ;;
        esac

        test ! -x "${EXE}" && EXE=/usr/X11R6/bin/xdm

        SERVICE="${EXE##*/}"
}

start() {
        setup_dm
        
        ebegin "Setting up ${SERVICE}"
        #save the prefered DM
        save_options "service" "${EXE}"
        #tell init to run /etc/X11/startDM.sh after current
        #runlevel is finished (should *not* be in the "boot"
        #                      runlevel).
        /sbin/telinit a &>/dev/null
        eend 0
}

stop() {
        local retval=0
        local curvt="$(fgconsole)"
        local myexe="$(get_options "service")"
        local myservice="${myexe##*/}"
        
        ebegin "Stopping ${myservice}"
        rm -f ${svcdir}/options/xdm/service
        
        if [ "$(ps -A | grep -e "${myservice}")" ]
        then
                start-stop-daemon --stop --quiet \
                        --exe ${myexe} &>/dev/null
                
                retval=$?
        else
                retval=1
        fi
        
        #switch back to original vt
        chvt "${curvt}" &>/dev/null
        eend ${retval} "Error stopping ${myservice}."
        
        return ${retval}
}


# vim:ts=4
沒錯, emerge xfree...
「從麻雀之城回來的時候,被問到『你要大的藤箱還是小的藤箱?』為此煩惱不已。大家都有過這種煩惱吧?」
「是啊是啊!大的藤箱可以放很多東西覺得很划算,小的藤箱小小的裡面也許放著很不錯的東西,真的很難取捨阿!」
「靠這個就能告別這種煩惱『中型的藤箱』!」
「好厲害!」
「不要再煩惱大小的問題了,現在還贈送可以煮出鐵質,增進健康的鐵銼刀。」
「這是一定要買的!」
「我要一個!」
pahud
24hr 義工
Posts: 1251
Joined: Tue Nov 26, 2002 10:22 pm
Contact:

Re: 剛手賤...

Post by pahud »

funal wrote:不小心把/etc/init.d/xdm這個檔給幹掉了...
死了..要emerge那一個套件啊??xfree嗎??

謝謝
這只是一個init script, 不用emerge xfree啦!
看誰有拿來copy一份即可,或直接拿Palatis轉貼的內容
編輯一個就好。

另外您的標題最好改一下,這標題很難讓人一眼看出文章的主旨喔!
Join GOT@SETI now!
Post Reply