Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 02 Sep 2014, 06:10
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
/usr/sbin/bootmanager improvements
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Fri 15 Jun 2012, 18:32    Post subject:  /usr/sbin/bootmanager improvements
Subject description: slow, ugly, others
 

Here i'll place my adjustments to bootmanager !

Today i decided 50 to 80 seconds had been too long on dual core 2,6GHz to build the addlist/yeslist database for the kernel modules .

Here's my yeslist function untidy, renamed to addlist() :

Code:
addlist_func() {
 #choose extra modules to load at bootup.

 TTY=`tty`
 TMP_DIR=/tmp/bootmanager;mkdir -p $TMP_DIR
 echo "Create db :`date`" 1>>$TTY

 #ALLMODULES="`cat /lib/modules/$KERNVER/modules.dep | cut -f 1 -d ':' | grep -o '[a-zA-Z0-9_-]*\.ko' | tr '\-' '_' | sort -u`"

 ALLMODULES=`modprobe -l |rev|cut -f 1 -d '/'|rev |sed 's|\.ko$||;s|\.ko\..*$||;s|-|_|g'|sort`
 echo "$ALLMODULES" > $TMP_DIR/ALLMODULES.lst
 HOW_MANY=`echo "$ALLMODULES" |wc -l`

 yaf-splash -font "8x16" -outline 0 -margin 4 -bg orange -text "Please wait, processing $HOW_MANY modules ..." &
 X1PID=$!

 . /etc/rc.d/MODULESCONFIG
 MODLIST=""
 #note, lsmod will show all modules with '-' as '_'...
 #LOADEDMODULES=" `lsmod | grep -v '^Module' | cut -f 1 -d ' ' | tr '\n' ' '`"

 LOADEDMODULES="`lsmod | grep -v '^Module' | cut -f 1 -d ' ' |sort`"
 echo "$LOADEDMODULES" > $TMP_DIR/LOADEDMODULES.lst
 grep -v -w -f $TMP_DIR/LOADEDMODULES.lst $TMP_DIR/ALLMODULES.lst > $TMP_DIR/FILTERED_MODULES.1.lst
 echo "$ADDLIST" |tr ' ' '\n ' |sed '/^$/d;s|\:.*||' |sort > $TMP_DIR/ADDLIST.lst
 grep -v -w -f $TMP_DIR/ADDLIST.lst $TMP_DIR/FILTERED_MODULES.1.lst > $TMP_DIR/FILTERED_MODULES.2.lst

 loop_1(){  #creates "off" list
 echo "First loop :`date`" 1>>$TTY
 for ONEMOD in $ALLMODULES
 do
  #NAMEONLY="`basename $ONEMOD .ko`"
  #NAMEONLY=${ONEMOD##*/};
  #NAMEONLY=${NAMEONLY//\.ko*/}
  #NAMEONLY=${ONEMOD//\.ko*/}
  NAMEONLY="$ONEMOD"
  MODPATTERN=" $NAMEONLY "
  #leave off list if already loaded...
  [ "`echo "$LOADEDMODULES" | grep "$MODPATTERN"`" ] && continue
  MODPATTERN=' '"$NAMEONLY"'[ :]'
  #leave off left pane if already on right pane...
  [ "`echo "$ADDLIST" | grep "$MODPATTERN"`" ] && continue
  MODLIST="$MODLIST $NAMEONLY $NAMEONLY off"
 done
 echo "First loop :`date`" 1>>$TTY
}

 cat $TMP_DIR/FILTERED_MODULES.2.lst | sed 's|\(.*\)|\1 \1 off|' > $TMP_DIR/OFFLIST.lst
 cat $TMP_DIR/ADDLIST.lst  | sed 's|\(.*\)|\1 \1 on|' > $TMP_DIR/ONLIST.lst

 loop_2(){  ##creates "on" list
 echo "Second loop :`date`" 1>>$TTY
 #check for parameters
 for ONEMOD in $ADDLIST
 do
  NAMEONLY="$ONEMOD"
  xONEMOD="$ONEMOD"
  if [ `echo -n "$ONEMOD" | tr ':' ' ' | wc -w` -gt 1 ];then
   MPARAMS="`echo -n "$ONEMOD" | cut -f 2-9 -d ':' | tr ':' ' '`"
   NAMEONLY="`echo -n "$ONEMOD" | cut -f 1 -d ':'`"
   xONEMOD="$NAMEONLY $MPARAMS"
  fi
  MODPATTERN=" $NAMEOLY "
  #leave off list if already loaded...
  [ "`echo "$LOADEDMODULES" | grep "$MODPATTERN"`" != "" ] && continue
  MODLIST="$MODLIST $ONEMOD \"$xONEMOD\" on"
 done
 echo "Second loop :`date`" 1>>$TTY
}

 MODLIST="`cat $TMP_DIR/ONLIST.lst |tr '\n' ' '` `cat $TMP_DIR/OFFLIST.lst |tr '\n' ' '`"
 kill $X1PID
 echo "Create db :`date`" 1>>$TTY
 echo "Xdialog: `date`" 1>>$TTY
 #gui
 EXECME="Xdialog --wmclass \"module16\" --title \"BootManager: Module add-list manager\" --left --stdout --separator \" \" --buildlist \"On the left pane is the complete list of modules available to be\nused by Puppy (and not currently loaded).\nOn the right pane are modules that you have explicitly chosen to\nbe loaded at bootup (not auto-loaded by default).\nIf you want to force a module to load, move it to the right pane,\nclick OK button, then reboot Puppy.\nNote, if you want to find out further information about any module,\nrun PupScan (look in the System menu)\" 0 0 8 $MODLIST >$TMP_DIR/yesrettags.txt"
 eval $EXECME
 RETVAL=$?
 echo "Xdialog: `date`" 1>>$TTY
 [ $RETVAL -eq 0 ] || return 1
 cat $TMP_DIR/yesrettags.txt | tr ' ' '\n' | tr ':' ' ' > $TMP_DIR/modules_addlist_edit #v411
 Xdialog --backtitle "If you wish, add any required parameters to these modules\nExample: mmc_block major=179\nIf you don't know what this means, just click 'OK' button"  --wmclass "module16" --title "BootManager: Edit module addlist" --left --stdout --no-cancel --editbox $TMP_DIR/modules_addlist_edit 0 0 > $TMP_DIR/modules_addlist_edit_out
 [ $? -ne 0 ] && return 1
 ADDLIST="`cat $TMP_DIR/modules_addlist_edit_out`"
 ADDLIST=' '"`echo "$ADDLIST" | tr ' ' ':' | tr '\n' ' ' | tr -s ' '`"
 #ADDLIST=" `cat /tmp/yesrettags.txt | tr '\n' ' '`"
 #now update /etc/rc.d/MODULESCONFIG...
 grep -v '^ADDLIST' /etc/rc.d/MODULESCONFIG > /tmp/MODULESCONFIG
 mv -f /tmp/MODULESCONFIG /etc/rc.d/MODULESCONFIG
 echo "ADDLIST='${ADDLIST}'" >> /etc/rc.d/MODULESCONFIG
} #end addlist_func


using basename i had for the loop_1 times :
First loop :Fr 15. Jun 23:08:59 GMT+1 2012
First loop :Fr 15. Jun 23:10:12 GMT+1 2012
1min 13 sec .

using shell substitution for loop_1
First loop :Fr 15. Jun 23:27:25 GMT+1 2012
First loop :Fr 15. Jun 23:28:20 GMT+1 2012
55 sec .

using ^heavy^ grep and sed :
Create db :Sa 16. Jun 00:14:08 GMT+1 2012
Create db :Sa 16. Jun 00:14:09 GMT+1 2012
1 sec.
:SHOCK: Very Happy

:NOTE: it is 4.3.1 bootmanager in this post !

[update 2012-06-20]

added two times -w option to grep

grep -v -f $TMP_DIR/*.lst would accidentally filter all acpi modules for exemple if 'ac' module is currently loaded

[/update 2012-06-20]
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 17 Aug 2013, 16:37    Post subject: make bootmanager yeslist_func load the module(s)  

Code:
 #now also load the module
 for module in $ADDLIST
 do
 echo "'$module' '${module%%:*}' '${module#*:}'" >&2
 params="${module#*:}"
 params="${params//:/ }"
 echo $params >&2
 [ "$params" = "${module%%:*}" ] && params='';
 modprobe -v --first-time ${module%%:*} $params
 done
 dmesg | tail -n 10 >&2
 
} #end yeslist_func

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2238

PostPosted: Sun 18 Aug 2013, 04:32    Post subject:  

Just a tip, 'modprobe -l' is not forward-compatible with modern kmod-based tools.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sun 18 Aug 2013, 09:03    Post subject:  

Yep, noticed this in current Slacko.
Hate many of the new *exciting* updates and upgrades .
Think or hope, they might implement it one day .
My experiments with altering the source code of the "old" modprobe.c file showed that
though all short and long options were already implemented since version 3.3.x ,
it needed version 3.12 that getopt would have parsed them all (correctly) .
Cannot believe that it took so long to fix this .
Even the Debian and Ubuntu patches never tried to fix this .
And modprobe is one of the most important Linux tools !!
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sun 18 Aug 2013, 09:47    Post subject:  

Ah, and before I forget : /bin/busybox modprobe supports the -l option , at least since version 1.17.4 .
But I configure busybox not with simplified modutils .

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Thu 22 Aug 2013, 15:50    Post subject:  

About one of the ugly sides :

GTK and gtkdialog have some problems when starting other GUIs from their interfaces . These new GUIs block the sight on the first GUI and moving the new GUI with the mouse often rubs out the text in the GUI underneath .
If the new GUI does not need to update anything inside the first GUI, then it could be started as forked program :
Code:
    <text><label>`gettext \"Click here to 'blacklist' a module:\"`</label></text>
     <button>
      <input file>/usr/local/lib/X11/pixmaps/module24.xpm</input>
-     <action>bootmanager blacklist</action>
+     <action>bootmanager blacklist &</action>
     </button>
   </hbox>
   <hbox>
    <text><label>$(gettext 'Click here to add a new module:')</label></text>
     <button>
      <input file>/usr/local/lib/X11/pixmaps/module24.xpm</input>
-     <action>bootmanager yeslist</action>
+     <action>bootmanager yeslist &</action>
     </button>
   </hbox>
   <hbox>
    <text><label>$(gettext 'Give preference to one module over another:')</label></text>
     <button>
      <input file>/usr/local/lib/X11/pixmaps/module24.xpm</input>
-     <action>bootmanager preflist</action>
+     <action>bootmanager preflist &</action>
     </button>
   </hbox>
  </frame>
@@ -577,11 +577,11 @@ export MAIN_DIALOG="
    <text><label>$(gettext 'Choose which system services to run at startup:')</label></text>
     <button>
      <input file>/usr/local/lib/X11/mini-icons/so.xpm</input>
-     <action>bootmanager sysdaemons</action>
+     <action>bootmanager sysdaemons &</action>
     </button>
   </hbox>
  </frame>
shot-2013-08-21_15-32-47.jpg
 Description   
 Filesize   45.58 KB
 Viewed   238 Time(s)

shot-2013-08-21_15-32-47.jpg

Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2238

PostPosted: Fri 23 Aug 2013, 02:11    Post subject:  

Actually, I think that behavior comes from rox or the WM.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 24 Aug 2013, 08:09    Post subject:  

This behavior is present at any Windowmanager I used .
The above was e17 which does not use ROX-Filer pinboard , just as filemanager , and this below is openbox with rox pinboard .
bootmanager_openbox_wm.jpg
 Description   
 Filesize   30.08 KB
 Viewed   182 Time(s)

bootmanager_openbox_wm.jpg

Back to top
View user's profile Send private message Visit poster's website 
Keef


Joined: 20 Dec 2007
Posts: 622
Location: Staffordshire

PostPosted: Sat 24 Aug 2013, 10:40    Post subject:  

This always happens with Puppy Package Manager (although I don't use it very often). Nice to know there is a specific reason.

Bootmanager just as bad, but hadn't noticed it before.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0803s ][ Queries: 13 (0.0050s) ][ GZIP on ]