Re: Simple little basic config questions
On Sat, Oct 25, 2003 at 08:57:41PM -0400, Haines Brown wrote:
>
> ...
>
> 3. My usual practice is to avoid xdm and boot to a text login
> prompt. To do this, in rc2.d I belive I edited the symlink to the
> xdm program, renaming "S99xdm ->..." to "K99xdm ->...". But in
> debian I get a beep when I try. Am I imagining I once edited the
> name of a symlink? Can't one do it in debian?
>
> Haines Brown
>
Same with me,
if you'd like some additional first aid to temporarily remove / restore
any command in '/etc/init.d/' (including all related softlinks), you
might try my bash script, I named '/usr/local/bash/init.d':
#######################################################################
#!/bin/sh
# \wwf 9.3.02
USE () {
echo
echo "========================================================"
echo "Save+Remove // Restore Start_Stop Files in /etc/init.d/"
echo "========================================================"
setterm -bold on
echo 'including related Links in /etc/rc?.d/'
setterm -bold off
echo
echo
echo "usage:"
echo
echo "$0 [{-s|-r}] <fname ...> (-s = default)"
echo "--------------------------------------------------------"
echo '( put Filename Wildcards in Double-Quotes: "*", "?" )'
echo
echo
echo 'Options:'
echo '--------'
echo '-s = (S)ave files to /etc/init.d/SAVE/<file>.tar.gz'
echo '-r = (R)estore files from /etc/init.d/SAVE/<file>.tar.gz'
echo
echo '(-s: Files are MOVED from Directories to Archive)'
echo '(-r: Files are MOVED from Archive to Directories)'
echo
echo
}
Save () {
test -d /etc/init.d/SAVE || mkdir /etc/init.d/SAVE
echo "Save+Deinstall init.d Files to /etc/init.d/SAVE/<file>.tar.gz"
echo "============================================================="
cd /etc/init.d
for FILE in ${@}; do
echo
# Skip bad Params
if [ ! -f ${FILE} ]; then
echo "/etc/init.d/${FILE}: NO FILE -- skipping Param"
echo "------------------------------------------------------"
echo
continue ## comment this line: save links only
# ## when /etc/init.d/<file> is missing
fi
if [ -f SAVE/${FILE}.tar.gz ]; then
echo "Dest_Archive already exists:"
echo "NO REwriting to /etc/SAVE/${FILE}.tar.gz -- skipping Param"
echo "----------------------------------------------------------"
echo
continue
fi
# Begin of Job
echo -n "Save+Deinstall /etc/init.d/${FILE} ? "; read answ
case "$answ" in
y*|Y*|j*|J*) echo "Answer = ${answ}";; # Save Files
* ) echo "Answer = ${answ}: NO Action -- skipping Param"
echo
continue
esac
echo
echo Saving spec''d Files to /etc/init.d/SAVE/${FILE}.tar.gz
echo "---------------------------------------------------------"
find /etc/rc* /etc/init.d -name "*${FILE}" | \
tar -cvzf /etc/init.d/SAVE/${FILE}.tar.gz -PT -
echo
echo "Comparing Tar Archive to orig. Source Files"
echo "-------------------------------------------"
tar -dvzf /etc/init.d/SAVE/${FILE}.tar.gz
if [ `echo $?` = 0 ]; then
echo
echo "=================="
echo "All Files saved OK"
echo "=================="
echo
echo -n "Remove saved Source Files now ? "; read answ
case "$answ" in
y*|Y*|j*|J*) echo "Answer = ${answ}";; # Remove Files
* ) echo "Answer = ${answ}: Files NOT removed"
i echo
continue
esac
echo
echo "Removing saved Files from /etc/rc*/ /etc/init.a/"
find /etc/rc* /etc/init.d -name "*${FILE}" -exec rm {} \;
else
echo
echo "ERROR, BAD Match!!"
echo "=================="
echo "/etc/init.d/SAVE/${FILE}.tar.gz differs to"
echo "Source Files in /etc/rc*/, /etc/init.d/"
echo "NO File removed"
echo
fi
done
}
Restore () {
echo "Reinstall Files from /etc/init.d/SAVE/<file>.tar.gz"
echo "---------------------------------------------------"
cd /etc/init.d/SAVE/
for FILE in ${@}; do
echo
ARCHIV=""
[ -f ${FILE} ] && ARCHIV=${FILE}
[ -f ${FILE}.tar.gz ] && ARCHIV=${FILE}.tar.gz
## echo "File = " ${FILE} "Archive = " ${ARCHIV}; read answ
if [ -z ${ARCHIV} ]; then
echo "NO matching Archive: " ${FILE} "-- skipping Param"
echo
continue
fi
echo -n "Reinstall ${ARCHIV} ? "; read answ
case "$answ" in
y*|Y*|j*|J*) ;; # Answer = 'yes', start Job
* ) echo "Answer = ${answ}: NO Action taken!!";
echo
continue;;
esac
echo "Reinstalling Archive to /etc/rc*, /etc/init.d/"
tar -xvkzf ${ARCHIV} -P
echo -n "Remove" ${ARCHIV} "now ? "; read answ
case "$answ" in
y*|Y*|j*|J*) echo "Answer = ${answ}";; # Remove Archive
* ) echo "Answer = ${answ}: Archive NOT removed"
echo
continue;;
esac
echo
echo "Removing" /etc/init.d/SAVE/${ARCHIV}
rm ${ARCHIV}
done
}
# -----------------------------------------------------------------
# main prog
# -----------------------------------------------------------------
clear
[ $# = 0 ] && USE && exit 1 # -> No Param: Help
JOB=Save; # default -> Save to tar archive, Deinstall
case $1 in
-s ) JOB=Save; shift;; # -> Save to tar archive, Deinstall
-r ) JOB=Restore; shift;; # -> Reinstall from tar archive
-* ) USE; exit 1 # -> Help
esac
# Select JOB: Deinstall, Reinstall or Remove
${JOB} ${@} && exit 0 || exit -1
#######################################################################
Reply to: