On Tuesday 07 October 2003 12:58, Paul Fraser wrote:
> It looks like I'm in luck, actually. I've managed to remerge and recover
> all except the XFree86 ones.
>
> Thanks for the suggestion and the offer. If possible, would I be able to
> get copies of /etc/init.d/xdm and /etc/init.d/xfs?
>
xdm and xfs attached
Cheers,
Renat
>
> On Tue, 2003-10-07 at 20:32, Jason Stubbs wrote:
> > On Tuesday 07 October 2003 18:55, Paul Fraser wrote:
> > > I made a real big mistake, and I'm somewhat annoyed with myself now.
> > >
> > > I was cleaning up a script in /etc/init.d/ that configures my IPv6
> > > tunnel. I'd perfected it and was ready to get rid of the backups I made
> > > (ipv6-backup and so forth), so I typed in "rm ipv6-" and hit tab,
> > > expecting it to autocomplete. I then quickly hit asterisk and enter.
> > >
> > > Oops! There was only one file! So instead of doing "rm ipv6-backup*"
> > > which wouldn't have been so bad, I instructed the computer to do "rm
> > > ipv6-backup *" (Note the space).
> > >
> > > Now I'm in the middle of remerging all the apps which (I think) added
> > > init scripts to /etc/init.d. I'm hoping there's an easier and faster
> > > way to recover these scripts. (Yes, I've got baselayout, that's the
> > > essential system ones.. I'm talking about stuff like apache, fam-oss,
> > > portmap and so forth) I'm not looking forward to sitting through
> > > another XFree86 compile, so is there some way for me to grab these
> > > scripts? Recover them or emerge ONLY them?
> >
> > Not really unless you have built packages. How about listing what
> > packages you need and then people can email you the scripts. More
> > responses means more copies which you can use to confirm validity. They
> > should be small enough for email...
> >
> > Jason
> >
> > --
> > [EMAIL PROTECTED] mailing list
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-x86/x11-base/xfree/files/4.3.0/xdm.start,v 1.1
2003/02/28 04:28:29 seemant 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)"
;;
ELOGIN*)
EXE="$(which elogind)"
;;
ENTRANCE*)
EXE="$(which entranced)"
;;
GDM|GNOME)
EXE=/usr/bin/gdm
;;
*)
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
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author: Martin Schlemmer <[EMAIL PROTECTED]>
# $Header: /home/cvsroot/gentoo-x86/x11-base/xfree/files/4.3.0/xfs.start,v 1.2
2003/04/13 01:02:03 azarah Exp $
#NB: Config is in /etc/conf.d/xfs
opts="${opts} mkfontdirs"
depend() {
use logger
}
check_config() {
if [ -z "${XFS_PORT}" ]
then
eerror "Please set \$XFS_PORT in /etc/conf.d/xfs!"
return 1
fi
return 0
}
# Return 0 on change, or 1 on no change, or if dir do not exist
check_changed() {
local x=""
local fontlist=""
# If the dir do not exist, e
if [ ! -d $1 ]
then
return 1
fi
# Create a list of all non known config files in the font dir
fontlist="$(find $1/ -type f -maxdepth 1 | \
gawk '$0 !~ /fonts\..*$|^.*\.dir$|XftCache/ {print}')"
if [ ! -f $1/fonts.list ]
then
if [ -n "${fontlist}" ]
then
# No list file exist, so create it and return 0 to add
# this font dir as a candidate for updating...
echo "${fontlist}" > $1/fonts.list
return 0
fi
else
local retval=1
# All the fonts was removed, so cleanup
if [ -z "${fontlist}" ]
then
for x in $1/fonts.* $1/encodings.dir $1/XftCache
do
if [ -f ${x} ]
then
rm -f ${x}
fi
done
return 1
fi
# Check that no files was added or removed....
if [ "$(cat $1/fonts.list | md5sum)" != "$(echo "${fontlist}" |
md5sum)" ]
then
retval=0
fi
# Check that no files was updated....
if [ "${retval}" -ne 0 ]
then
local changed_list=""
# It should be more consistant if we consider a change to fonts.scale, or
# encodings.dir files as a need for an update as well ...
# changed_list="$(find $1/ -type f -cnewer $1/fonts.dir | \
# gawk '$0 !~ /fonts\..*$|^.*\.dir$|XftCache/
{print}')"
changed_list="$(find $1/ -type f -cnewer $1/fonts.dir | \
gawk '$0 !~ /fonts\.(list|cache-1)$|XftCache/
{print}')"
if [ -n "${changed_list}" ]
then
retval=0
fi
fi
# OK, something changed, so recreate fonts.list and add as candidate
# for updating...
if [ "${retval}" -eq 0 ]
then
echo "${fontlist}" > $1/fonts.list
return 0
fi
fi
return 1
}
# This is a function to extract font dirs from
# the xfs config file (/etc/X11/fs/config).
get_fontdir_list() {
[ ! -r /etc/X11/fs/config ] && return 0
gawk '
BEGIN {
while((getline xfsconf_data < ("/etc/X11/fs/config")) > 0) {
# Strip any comments
if (xfsconf_data !~ /^[[:space:]]*#/) {
# Dont bother if its a blank line
if (xfsconf_data == "") continue
# If we have a line that contain 'catalogue=',
we
# should be where the list of font dirs are
if (xfsconf_data ~ /catalogue[[:space:]]*=/)
DO_WRITE = 1
# Ok, we got our que, so start
if (DO_WRITE) {
# Strip any leading spaces and tabs
sub(/^[[:space:]]*/, "", xfsconf_data)
# Strip the 'catalogue=' part
sub(/catalogue[[:space:]]*=[[:space:]]*/, "", xfsconf_data)
# The last font dir will not have a
',', so this will
# be the last line we read ...
if (xfsconf_data !~ /,$/) {
DO_WRITE = 0
DONE = 1
}
# Strip the ending ',' ...
sub(/,$/, "", xfsconf_data)
# If we have a valid font path, print
it
if (xfsconf_data != "") {
have_dup = 0
# Check for duplicates ...
for (x in DIRLIST)
if (DIRLIST[x] ==
xfsconf_data) {
have_dup = 1
break
}
if (!have_dup) {
print xfsconf_data
DIRLIST[++i] =
xfsconf_data
}
}
}
# No need to continue reading the file ...
if (DONE) break
}
}
close("/etc/X11/fs/config")
}'
return 0
}
# This is the main beast for setting up the font dirs
setup_font_dirs() {
local x=""
local pending_fontdirs=""
local changed="no"
umask 022
if [ ! -x /usr/X11R6/bin/mkfontdir -o ! -x /usr/X11R6/bin/ttmkfdir ]
then
ewarn "Could not find the mkfontdir or ttmkfdir binaries!"
return 0
fi
if [ ! -d /usr/X11R6/lib/X11/fonts/encodings ]
then
ewarn "Encodings directory are missing!"
ewarn "Please restore /usr/X11R6/lib/X11/fonts/encodings ..."
return 0
fi
# Generate the encodings.dir ...
/usr/X11R6/bin/mkfontdir -n \
-e /usr/X11R6/lib/X11/fonts/encodings \
-e /usr/X11R6/lib/X11/fonts/encodings/large \
-- /usr/X11R6/lib/X11/fonts/encodings
ebegin "Scanning font directories"
for x in $(get_fontdir_list)
do
if test -d ${x} && check_changed ${x}
then
if [ -z "${pending_fontdirs}" ]
then
pending_fontdirs="${x}"
else
pending_fontdirs="${pending_fontdirs} ${x}"
fi
fi
done
eend 0
if [ -n "${pending_fontdirs}" ]
then
ebegin "Indexing font directories"
for x in ${pending_fontdirs}
do
ebegin " ${x}"
# Only generate .scale files if there are truetype fonts
present ...
if [ "${x/encodings}" = "${x}" -a \
-n "$(find ${x} -iname '*.[otps][pft][cfad]' -print)" ]
then
/usr/X11R6/bin/ttmkfdir -x 2 \
-e
/usr/X11R6/lib/X11/fonts/encodings/encodings.dir \
-o ${x}/fonts.scale -d ${x} > /dev/null
fi
# Now generate fonts.dir files ...
if [ "${x/encodings}" = "${x}" ]
then
/usr/X11R6/bin/mkfontdir \
-e /usr/X11R6/lib/X11/fonts/encodings \
-e /usr/X11R6/lib/X11/fonts/encodings/large \
-- ${x} > /dev/null
fi
if [ "${x/encodings}" = "${x}" -a -x /usr/X11R6/bin/xftcache ]
&& \
[ -n "$(find ${x} -iname '*.[otps][pft][cfad]' -print)" ]
then
# xftcache is broken, but run it anyhow ...
/usr/X11R6/bin/xftcache ${x} &> /dev/null
fi
eend 0
changed="yes"
done
fi
# While we at it, update fontconfig's cache as well
if [ -x /usr/bin/fc-cache -a "${changed}" = "yes" ]
then
ebegin "Updating FC cache"
HOME="/root" /usr/bin/fc-cache -f
eend 0
fi
}
mkfontdirs() {
setup_font_dirs
}
start() {
check_config || return 1
if [ "${SETUP_FONTDIRS}" = "yes" ]
then
setup_font_dirs
fi
ebegin "Starting X Font Server"
if [ "`grep -e "^xfs:" /etc/passwd`" ] ; then
start-stop-daemon --start --quiet --exec /usr/X11R6/bin/xfs \
-- -daemon -config /etc/X11/fs/config \
-droppriv -user xfs -port ${XFS_PORT} 1>&2
else
start-stop-daemon --start --quiet --exec /usr/X11R6/bin/xfs \
-- -daemon -config /etc/X11/fs/config \
-port ${XFS_PORT} 1>&2
fi
eend $?
}
stop() {
ebegin "Stopping X Font Server"
start-stop-daemon --stop --quiet --exec /usr/X11R6/bin/xfs 1>&2
rm -rf /tmp/.font-unix
eend $?
}
# vim:ts=4
--
[EMAIL PROTECTED] mailing list