<xmp><!-- <body> --></xmp>


Linux logo

DSL Fixes.

Home:: Info :: shlocate :: kxsetup :: shxtdesk :: kswitch.lua :: mydsl-toad :: Credits :: &c.


+++ shlocate
#!/bin/sh
#========

echo ooo
echo Linux file locator v2.1
echo =======================

if [ ":$2:" == "::" ] 
then
  echo Usage: $0 '"--nam filespec" | "--str | --kno string [parm]"'
  echo
  echo '--nam searches entire system for specified files'
  echo '--str searches for files containing string; includes (most) hidden'
  echo '      (current dir & below)'
  echo '--kno searches for files containing string; visible only'
  echo '      (/KNOPPIX: dev, var, etc/skel/.dfmdesk omitted'
  echo
  echo 'short style parms accepted (-n -s -k)'
  echo 'strings containing spaces must be quoted'
  echo '(optional parm following string is passed to grep: "l" is useful)'
  echo
  exit 1
fi

FUNC=$1
SPEC=$2
PARM=$3

selgrep() { MAINDIR=$1 ; OMITDIR=$2
# SELective GREP: skips directories known to be *problems*
  cd ${MAINDIR}
  echo Scanning ${MAINDIR} for \"${SPEC}\" ...
  sudo grep -is${PARM} "${SPEC}" *
  for DIR in $(ls | sed "s_${OMITDIR}__g" | sed "s_dev__g" | sed "s_var__g")
  do
    sudo grep -irs${PARM} "${SPEC}" ${DIR}
  done
  return 0
}

findnam() {

  echo Searching for files matching ${SPEC} ...
  find / -name ${SPEC} 2>/dev/null
  return 0
}

findstr() {

  echo Scanning $(pwd) for \"${SPEC}\" ...
# non-hidden files
  sudo grep -irs${PARM} "${SPEC}" * 
# (most) dotfiles but *not* parent directory
  sudo grep -irs${PARM} "${SPEC}" .[a-zA-Z0-9]*
  return 0
}

findkno() {

  selgrep /KNOPPIX          etc
  selgrep /KNOPPIX/etc      skel
  selgrep /KNOPPIX/etc/skel .dfmdesk
  return 0
}

case ${FUNC} in
  --nam | -n ) findnam ;;
  --str | -s ) findstr ;;
  --kno | -k ) findkno ;;
           * ) echo $0 : undefined function ;;
esac

exit 0


+++ DSL xsetup.sh enhancer
#!/bin/sh
#========

# Screaming CuckooBroad Associates 2009
# wrapper for DSL xsetup.sh (ie /usr/sbin/kbdconfig)
# undoes Shingledeckerian damage to runtime environment
# repairs /opt/bootlocal.sh & permits customisation of generated .xserverrc

aterm +tr --title "Xwindow configuration" -e xsetup.sh
sudo loadkeys ~/kp

# repair /opt/bootlocal.sh

INIT=/opt/bootlocal.sh
  chown dsl.staff ${INIT}
  chmod 777       ${INIT}

# customise .xserverrc

cd ~
cp -p .xserverrc .xserverrcV

cat >.xserverrc << :EOF:

# customisations to .xserverrc added by kxsetup (qv comments therein)
# syslogd is to mask APM vs ACPI messages at server init time
# exec has to wait until its actually up (& then some)

  echo '.xserverrc (!)'
  pidof syslogd &>/dev/null || sudo syslogd
  while [ 0 == 0 ]
  do
    pidof syslogd &>/dev/null && break
  done
  sleep 1

# generated server invocation follows:

:EOF:

cat .xserverrcV >>.xserverrc

exit 0


+++ shxtdesk
#!/bin/sh
#========

# shxtdesk : xtdesk driver for DSL 4.4.10 : Screaming CuckooBroad Associates 2009
# performs reinitialisation of xtdesk from .xinitrc or without cycling Xwindow
# when X cycled: takes spec from .desktop as maintained via kswitch.lua
# (permits population of .xtdesktop directory with user-defined icon complement)
# run within X: properly updates sessiontime icons after UCI dismounts
# /tmp/xicostat flagfile establishes session stasis; boottime reinit if removed
# let the healing begin

# echo 'shxtdesk starting ...'

cd ~
ORIGIN=/KNOPPIX/etc/skel/.xtdesktop
KES=$(dirname  ${ORIGIN})
XTD=$(basename ${ORIGIN})
sudo chmod 777 ${XTD}
sudo chmod 777 ${XTD}/*

# $1 is only nonblank run from .xinitrc; "xtdeskuser" returned from .desktop
  [ -f /tmp/xicostat ] || rm -rf ${XTD}/* &>/dev/null
  [ "$1" == "xtdesk" ] && KSOURCE=${ORIGIN} || KSOURCE=${XTD}K
  cp -p ${KSOURCE}/* ${XTD}
  echo "delete me for coldstart-style icon repopulation via xtdesk" >/tmp/xicostat

# set up proper mp3 symlink for NTFS / FAT / ext2 / ISO
  KDATA=$(echo $(zkp) | sed "s_/unx__g")
  [ -d ${KDATA}/mp3 ] && KPMP3=mp3 || KPMP3=MP3
  ln -sfn ${KDATA}/${KPMP3} /opt/bin/kpmp3

# xtdesk will fail to start if *.lnk files have no corresponding *.png or *.xpm
for i in $(ls ${XTD}/*.lnk)
do
  ICON=0
  BASE=${i%.lnk}
  [ -f ${BASE}.png ] && ICON=1
  [ -f ${BASE}.xpm ] && ICON=1
  [ "${ICON}" == "0" ] && cp ${ORIGIN}/program.png ${BASE}.png
done

# terminate xscreensaver daemon & reset screenblanker
pidof xscreensaver &>/dev/null && sudo pkill -x xscreensaver &>/dev/null
xset s default

# The rest is verbatim replacement of iconsnap.sh. Thanx Bob.

# this is unquestionably the best form; encountered often
# while KPID=$(pidof xtdesk)
# do
#   sudo kill ${KPID}
# done

# this is fine but it kills *everything* on Solaris; dont get used to it
# pidof xtdesk &>/dev/null && sudo killall  xtdesk &>/dev/null

# if you must use a name then use pgrep w/ the "exact" switch
  pidof xtdesk &>/dev/null && sudo pkill -x xtdesk &>/dev/null

iconsnap.lua
# echo 'iconsnap.lua complete; starting xtdesk ...'
  nohup xtdesk &>/dev/null &
exit 0


+++ kswitch.lua
#!/bin/lua

-- Screaming CuckooBroad Associates
-- kswitch.lua v1.03.0002
-- DSL 4.4.10 [Debian / Knoppix] Linux 2.4.31 

-- permits independent switching among
-- multiple Window Managers & multiple icon modes
-- reenables xtdesk icons

-- based loosely on original by Robert Shingledecker
-- MurgaLua Version 0.6.8 (http://www.murga-projects.com/murgaLua/
-- MurgaLua FLTK bindings: Copyright 2006-8 John Murga, GPL license.
-- Warning: FLTK bindings is a subset of the full MurgaLua environment.

-- Please send *me* a check
-- I am a volunteer part of the GNU/Linux "community"
-- I "volunteered" to clean up the mess. Cheers you guyz

require("fltk")
dofile("/etc/init.d/functions5.lua")

boxwidth = 200
boxheight = 220
groupleft = 10
groupx = boxwidth - groupleft

w = fltk:Fl_Double_Window(boxwidth, boxheight, "DSL Desktop")
w:callback(
function(w)
  os.exit(0)
end)

wmGroup = fltk:Fl_Group(groupleft, 10, groupx, 90)

wmleft = 10
wmx = boxwidth - (2 * wmleft)
wmy = 25

icewmBtn = fltk:Fl_Round_Button(wmleft, 20, wmx, wmy, "IceWM Window Mgr")
icewmBtn:type(fltk.FL_RADIO_BUTTON)
icewmBtn:value(1)

fluxboxBtn = fltk:Fl_Round_Button(wmleft, 40, wmx, wmy, "Fluxbox Window Mgr")
fluxboxBtn:type(fltk.FL_RADIO_BUTTON)
fluxboxBtn:value(0)

jwmBtn = fltk:Fl_Round_Button(wmleft, 60, wmx, wmy, "JWM: Joes Window Mgr")
jwmBtn:type(fltk.FL_RADIO_BUTTON)
jwmBtn:value(0)

fltk:Fl_End()  -- End of wm group

iconGroup = fltk:Fl_Group(groupleft, 80, groupx, 110)

iconleft = 40
iconx = boxwidth - (2 * iconleft)
icony = 25

xtuserBtn = fltk:Fl_Round_Button(iconleft, 90, iconx, icony, "XTuser icons")
xtuserBtn:type(fltk.FL_RADIO_BUTTON)
xtuserBtn:value(1)

xtdeskBtn = fltk:Fl_Round_Button(iconleft, 110, iconx, icony, "XTdesk icons")
xtdeskBtn:type(fltk.FL_RADIO_BUTTON)
xtdeskBtn:value(0)

dfmBtn = fltk:Fl_Round_Button(iconleft, 130, iconx, icony, "DFM icons")
dfmBtn:type(fltk.FL_RADIO_BUTTON)
dfmBtn:value(0)

noiconsBtn = fltk:Fl_Round_Button(iconleft, 150, iconx, icony, "no icons")
noiconsBtn:type(fltk.FL_RADIO_BUTTON)
noiconsBtn:value(0)

fltk:Fl_End()  -- End of icon group

okBtn = fltk:Fl_Return_Button(20, 180, 60, 25, "OK")
okBtn:callback(
function(okBtn)
  wm = "iwprog"
  icons = "xtdesk"

-- Greetings from Shingledecker Lualand (!)
-- When /usr/bin/mydsl-load is run & it finds xtdesk running
-- it executes /usr/bin/iconsnap.sh. This will pkill xtdesk
-- but not restart it unless it finds 'xtdesk' in .desktop.
-- 'xtdesk user' is returned *without* the space in .xinitrc
-- when .desktop is parsed by /usr/bin/getoption.lua.

  if xtuserBtn:value() == 1 then
     icons = "xtdesk user"
  end
  if xtdeskBtn:value() == 1 then
     icons = "xtdesk"
  end
  if dfmBtn:value() == 1 then
     icons = "dfm"
  end
  if noiconsBtn:value() == 1 then
     icons = "noicons"
  end

  if icewmBtn:value() == 1 then
     wm = "iwprog"
  end
  if fluxboxBtn:value() == 1 then
     wm = "fluxbox"
  end
  if jwmBtn:value() == 1 then
     wm = "jwm"
  end

  home = os.getenv("HOME")
  file = home.."/.desktop"
  io.output(file)
  io.write("wm: "..wm.."\n")
  io.write("icons: "..icons.."\n")
  io.flush()
  io.output()

  os.execute("cp /opt/.mydsl_menu/"..wm.."/menu_template /opt/.mydsl_menu/"..wm.."/menu")
  for _,appname in ipairs(readDir("/tmp/mydsl.menu")) do
    os.execute("/usr/bin/desktop.sh "..appname)
  end

  os.execute("touch /tmp/xvesa")
  os.execute("killall Xvesa Xfbdev 2>/dev/null &")
  os.exit(0)
end)

cancelBtn = fltk:Fl_Button(120, 180, 60, 25, "Cancel")
cancelBtn:callback(
function(cancelBtn)
  os.exit(1)
end)

w:show()
Fl:run()


+++ mydsl-toad
#!/bin/sh
#(c) Robert Shingledecker 2004,2005,2006,2007
#
. /etc/init.d/dsl-functions
#
MYMENU="/tmp/mydsl.menu"
CMDLINE="$(cat /proc/cmdline)"
#
# Main
#
#if [ -n "$DISPLAY" ] && [ $UID != 1001 ]; then
#   echo "Non DSL User error." > /tmp/noload
#   echo "You must be logged in as user \"dsl\" to install a myDSL extension."
#   exit 1
#else
   rm -f /tmp/noload
#fi
if [ -n "$1" ]; then
   APP="$1"
else
   whiptail --title "Specify myDSL Extensions" --inputbox "Enter extension, e.g. /mnt/hda3/optional/myapp.dsl" 0 0 2>/tmp/mydsl.app
   APP=$(cat /tmp/mydsl.app)
   if [ ! -n "$APP" ]; then
      exit 1
   fi
fi
if [ -n "$2" ]; then
   mydsl-wget "$APP" "$2"
   if [ -f /tmp/noload ]; then
      cat /tmp/noload
      exit 1;
   fi
fi
#
case "$APP" in
   *.uci )
      APPNAME=$(getbasefile "$APP" 1)
      sudo /etc/init.d/mountci "$APP"
   ;;
   *.unc )
      if [ -f /etc/sysconfig/unionfs ]; then
        APPNAME=$(getbasefile "$APP" 1)
        sudo /etc/init.d/mountci "$APP"
      fi
   ;;
   *.dsl)
      APPNAME=$(getbasefile "$APP" 1)
      sudo /etc/init.d/mydsl-install "$APP"
      desktop.sh "$APPNAME"
   ;;
   *.tar.gz)
      APPNAME=$(getbasefile "$APP" 2)
      sudo /etc/init.d/mydsl-install "$APP"
      desktop.sh "$APPNAME"
   ;;
esac

# Following if fails at deinstall time because /tmp/mydsl.menu entry has
# already been deleted by mountci. Even without the WM tasks being checked
# theres no reason not to restart xtdesk or jwm at any time. Fluxbox part
# looks completely spurious tho. Maybe Ill care later.

# if [ -f "$MYMENU/$APPNAME" ]; then
     pidof xtdesk && iconsnap.sh
     pidof jwm >/dev/null && jwm -restart
     FLUXPID=$(pidof fluxbox) && kill -s SIGUSR2 "$FLUXPID"
# fi

# Above FLUXPID assignment results in $?=1 which makes VFU complain
# of a failed execution if the script drops thru. Yet another reason
# always to include an exit 0 if its your opinion your exceptionally 
# lousy script may have terminated successfully. Rest of code mine.

BSDIR=/opt/.mydsl_menu/iwprog
mkdir ${BSDIR} &>/dev/null
touch ${BSDIR}/menu_template
echo MyDSL-toad completed successfully. Press a key.
read
exit 0


GPL
© 2009 TRCM TranceRave Capital Management

Screaming CuckooBroad Associates part of the CircleOmega organisation TRCM

Free Web Hosting
<noscript> <!-- ooo