WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: load-grp script  (Read 5102 times)

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
load-grp script
« on: October 14, 2009, 04:59:17 AM »
Loads extension list, "load.grp" in tce dir when "base"  boot option is used.  
Changes /opt/tce.dir path  from /tmp  to tce dir. (edit TCEPATH & sed )
Place script in /opt/bootlocal.sh to automatically load list when base option is used.

note: a script to add/remove the "base" option in /menu.list makes this all very fast  

EDIT: I replaced this approach with symlinked groups  documented later in this thread.


Code: [Select]

#!/bin/ash

###### load-grp script, jpeters
#
#### Loads extension group  "load.grp"  in tce dir.  
#
#
### Edit path to default tce directory
TCEPATH="/mnt/hda1/tcZ2"

####  Change path to tce dir when loading BASE option
TCEDIR="$(cat /opt/.tce_dir)"
if [ $TCEDIR == "/tmp/tce/" ]; then
     if [ -f ${TCEPATH}/load.grp ]; then
           sed -i 's@/tmp/tce@/mnt/hda1/tcZ2@' /opt/.tce_dir
           TCEDIR="$(cat /opt/.tce_dir)"
     fi

cd ${TCEDIR}

######### Load default extensions

   if [ -f load.grp ]; then
     FILES="$(cat ./load.grp)"
     echo "installing load.grp extensions.........."

     for I in ${FILES}
       do
          tce-load -i ${I}
       done
   fi
fi

exit 0
 

"load" script for additional extensions as needed from tce dir.   eg,  "load gnumeric"  

Code: [Select]
#!/bin/ash

TCEDIR="$(cat /opt/.tce_dir)"
cd ${TCEDIR}

if [ ! -f ${1}*.tcz -a ! -f ${1}*.tczl -a ! -f ${1}*.tczm ] ; then
  echo "extention not present"
  exit 1
fi

FILE="$(find ${1}* | busybox grep -v .dep | busybox grep -v  .txt | busybox grep -v .list )"
 [ -n ${FILE} ] && tce-load -i ${FILE}

    
echo "done!"

exit 0


Sample "base" script for adding/removing bootoption. (edit path and sed search words to suit).

Code: [Select]

#!/bin/ash

### Adds/Removes "base" bootoption

MENUPATH=/mnt/hda1/boot/grub
cd ${MENUPATH}

#### Show Bootoptions
echo "bootoptions: "
busybox  grep -e  "showapps" menu.lst  

#### Prompt to add/remove "base"
echo ""
echo "Add/Remove 'base' (a/r)"  
read RESPONSE
case ${RESPONSE} in
  "a" )  sudo sed -i 's/showapps/showapps base/' ./menu.lst ;;
  "r" )  sudo sed -i 's/showapps base/showapps/' ./menu.lst ;;
esac

exit 0
« Last Edit: December 02, 2009, 12:06:47 PM by jpeters »

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: load-grp script
« Reply #1 on: October 19, 2009, 01:27:33 AM »
Edited load script to accommodate  .list files in tce dir
« Last Edit: October 19, 2009, 02:31:13 AM by jpeters »

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: load-grp script
« Reply #2 on: October 25, 2009, 07:14:07 PM »
If loading a new wm (jwm, etc), or to adjust flwm menus/icons (if loading from /opt/bootlocal):

  1.  <ctr-alt  backspace> to prompt and then "start x"
              OR
   2. add "text"  bootoption.  Type "startx" at prompt
              OR
   3. remaster for secure login ( there's a "noautologin" script).  Just login, no startx needed.
 
« Last Edit: October 25, 2009, 07:48:36 PM by jpeters »

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: load-grp script
« Reply #3 on: November 01, 2009, 02:40:46 AM »
Traditional Boot option using /tce  as database: (loads faster as of ver. 2.5 )

"make-grp"  script for creating tce-group  folder from the load.grp file (both are within /tce directory.    

Bootcode then gets set to /tce/tce-group. "load" script then set to /tce for apps as needed.  

note: tce-group consists of symlinks to tce_dir

Code: [Select]
#!/bin/ash

 ######## make-grp script #######
 #creates /tce/tce-group from load.grp file
 
 
 #Set path to main /tce dir
 TCEDIR="/mnt/hda1/tcZ2/"
 ##################

cd ${TCEDIR}
 if [ -f load.grp ]; then
   FILES="$(cat ./load.grp)"

#Make tce-group directory
  if [  -d ${TCEDIR}tce-group ]; then
   sudo rm ${TCEDIR}tce-group/*  
  
  elif [ ! -d ${TCEDIR}tce-group ]; then
   sudo mkdir ${TCEDIR}tce-group
  fi
   for I in ${FILES}
      do
        sudo ln -s  ${TCEDIR}${I}* ${TCEDIR}tce-group 2>/dev/null
            if [ -f ${TCEDIR}${I}.dep ]; then
                for deps in `cat ${TCEDIR}${I}.dep`    
                    do
                       sudo ln -s ${TCEDIR}${deps}* ${TCEDIR}tce-group 2>/dev/null
                    done
            fi
      done
fi
exit 0


sample menu.list script for loading tce-group:  (set paths and sed search)

Code: [Select]
#!/bin/ash

### Set path:

MENUPATH=/mnt/hda1/boot/grub

###########
cd ${MENUPATH}

#### Show Bootoptions
echo "bootoptions: "
busybox  grep -e  "showapps" menu.lst  

#### Prompt to add/remove "base"
echo ""
echo "Add/Remove 'tce-group' (a/r)"  
read RESPONSE
case ${RESPONSE} in  
  "a" )  sudo sed -i 's@tce=hda1/tcZ2@tce=hda1/tcZ2/tce-group@' ./menu.lst ;;
  "r" )  sudo sed -i 's@tce=hda1/tcZ2/tce-group@tce=hda1/tcZ2@' ./menu.lst ;;
esac

exit 0

load script; edit main /tce path to use as database for additional extensions as needed:
ex, "load gnumeric"  

Code: [Select]
#!/bin/ash

## loads extensions into from main /tce directory  (when group is loaded).

TCEDIR="/mnt/hda1/tcZ2"
cd ${TCEDIR}

FILE="$(ls | grep -e ${1}\.tcz[ml]*$)"
if [ ! ${FILE} ]; then  
   echo "extention not present"
   exit 1
fi
 
tce-load -i ${FILE}
    
echo "done!"

exit 0





« Last Edit: December 08, 2009, 12:19:44 AM by jpeters »

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: load-grp script
« Reply #4 on: November 10, 2009, 06:16:38 PM »
Since tce-group is just symlinks, I found it useful to keep /opt/.tce_dir listing the base dir so that scripts like "update" work (otherwise updates get installed to the group folder).  Issue is solved with a sed script placed in /opt/bootlocal.sh  (edit sed search to correct path)

Code: [Select]
#!/bin/ash

TCEDIR="$(cat /opt/.tce_dir)"

if [ `basename ${TCEDIR}` == "tce-group" ]; then
   sed -i 's@/mnt/hda1/tcZ2/tce-group@/mnt/hda1/tcZ2@' /opt/.tce_dir
fi

exit 0

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: load-grp script
« Reply #5 on: December 07, 2009, 03:03:37 AM »
updated "load" script to accomodate tczml, tczlm extensions

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 318
    • the trombone analog
Re: load-grp script
« Reply #6 on: December 07, 2009, 03:16:21 AM »
Ah, I see that I have duplicated some of your efforts! I'll read up and try to figure out exactly how yours works.