General TC > Programming & Scripting - Unofficial

extension audit script

<< < (4/21) > >>

jpeters:

--- Quote from: Jason W on October 18, 2009, 10:18:40 PM ---For running against a tce directory, "base norestore" would be the way to do it and then install coreutils into /tmp/tce.  I can drop the perl dependency as dos2unix is in base which I will use instead.  Stat was moved into coreutils so coreutils has to remain a dep.  

--- End quote ---

might add that it creates .list files in the tce dir (or wherever it's placed). 

jpeters:
"fix" script
Here's a quick hack that fixed extension permissions in my tce dir.  eg, "fix gnumeric"

Finds extension in tce_dir and sets tce.menu, tce.installed. tce.icons  to root:staff/775.
Rebuilds and copies to tce_dir. Deletes  old md5 file.

Rerunning audit creates new md5
 

--- Code: ---#!/bin/ash

TCEDIR="$(cat /opt/.tce_dir)"
[ -d /tmp/extract ] || sudo mkdir /tmp/extract
[ -d /tmp/work ] || sudo mkdir /tmp/work

cd ${TCEDIR}


APP="$(busybox find ${1}* | busybox grep -v .dep | busybox grep -v .txt | busybox grep -v .list )"  
if [ -z ${APP} ]; then
  echo "no match in tce dir"
  exit 1
fi
 

sudo mount ${APP} /tmp/extract -o loop,ro
sudo cp -Rp /tmp/extract/* /tmp/work
cd /tmp/work/usr/local
if [ -d tce.installed ]; then
   sudo chown -R root:staff tce.installed
   sudo chmod  775  tce.installed
   sudo chmod  644  tce.installed/*
fi
if [ -d tce.menu ]; then
   sudo chown -R root:staff tce.menu
   sudo chmod  775  tce.menu
   sudo chmod  644  tce.menu/* 
fi
if [ -d tce.icons ]; then
   sudo chown -R root:staff tce.icons
   sudo chmod  775  tce.icons
   sudo chmod  644  tce.icons/*
fi

cd /tmp/work
sudo mksquashfs  ./  /tmp/${APP}
sudo cp -p /tmp/${APP}  ${TCEDIR}


sudo rm ${TCEDIR}/${APP}.md5.txt


 

###### cleanup

sudo umount /tmp/extract
sudo rmdir /tmp/extract
sudo rm -R /tmp/work
sudo rm /tmp/${APP}

exit 0

--- End code ---

Jason W:
I will add a switch to prevent creating of list files as they would interfere with tce2tcz when run on the tce directory.  I didn't initially intend for this to be an audit tool for the tce directory but rather for extensions ready to be submitted.  But it does serve as a quick check for existing extensions in the tce dir especially in regards to the tce.installed thing.

I did use a "fix it" script on my mirror, using a check like in the audit script.

jpeters:

--- Quote from: Jason W on October 19, 2009, 07:34:02 AM ---I will add a switch to prevent creating of list files as they would interfere with tce2tcz when run on the tce directory.  I didn't initially intend for this to be an audit tool for the tce directory but rather for extensions ready to be submitted.  But it does serve as a quick check for existing extensions in the tce dir especially in regards to the tce.installed thing.

I did use a "fix it" script on my mirror, using a check like in the audit script.

--- End quote ---

I already altered update and load scripts in case people want them (only 4K for a record of extension files without an internet connection).

EDIT:  added 644 perm to tce/*

jpeters:
Is this script still working with updated squashfs?  I tried it with a newly compiled dialog.tcz, and it complained that the file was corrupted, although it worked fine.  

edit:  seems to work after I rebooted and tried again.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version