General TC > Programming & Scripting - Unofficial
Script using installwatch to create file list and package.
Jason W:
This script uses installwatch to create packages in the case where DESTDIR or similar is not available. Simply invoke the script followed by 'make install"
/tmp/installscript make install
And it will do it's thing. The file is commented with what can be changed and what does what.
Requires tar.tcz and checkinstall-tc.tcz
--- Code: ---#!/bin/sh
# Installwatch parsing routines taken from Lunar Linux and Checkinstall to
# create file lists and/or packages from 'make install'.
. /etc/init.d/tc-functions
if [ ! -f /usr/local/tce.installed/tar ]; then
echo "${RED}You need to install tar.tcz. Exiting..${NORMAL}"
exit 1
fi
if [ ! -f /usr/local/tce.installed/checkinstall-tc ]; then
echo "${RED}You need to install checkinstall-tc.tcz. Exiting..${NORMAL}"
exit 1
fi
######## SET THESE VARIABLES IF DESIRED.
WORKPATH=/tmp # a directory will be created in this path using the $PWD where the script
# was run, and will be where the files and package will reside. It is
# named using the $PWD to seperate the results of different package builds.
INSTALLWATCHLOGPATH=/tmp # Location of installwatch files, not important per se.
PACKAGE=YES ## YES creates a tarball of the package in $WORKPATH, leave blank to not.
COMMAND="${*##${0}}" # Uses the command invoked after this script, can hardcode to 'make install' if desired.
BASEDIR="$WORKPATH"/`basename "$PWD"` # The actual directory where the results will reside.
# Adjust WORKPATH for the desired location.
########
[ -d "$INSTALLWATCHLOGPATH" ] || mkdir "$INSTALLWATCHLOGPATH"
[ -d "$BASEDIR" ] || mkdir -p "$BASEDIR"
> "$INSTALLWATCHLOGPATH"/logfile
installwatch -r "$INSTALLWATCHLOGPATH" ${COMMAND}
cd "$BASEDIR"
EXCLUDE="(^/dev|^/tmp|^$BASEDIR|^/mnt|^/home|^/proc|^/sys)"
parse_file() {
cat "$INSTALLWATCHLOGPATH"/logfile | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access|rename)' | cut -f 3 | egrep -v "$EXCLUDE" | grep "^/"
cat "$INSTALLWATCHLOGPATH"/logfile | cut -f 4 | egrep -v "$EXCLUDE" | grep "^/"
}
existing(){
while read FILE ; do
if [ -e "$FILE" ] ; then
echo "$FILE"
fi
done
}
parse_file | sort | uniq | existing > filelist
sed -i 's:^/::g' filelist
PKGNAME=`basename "$PWD"`
if [ "$PACKAGE" == "YES" ]; then
sed -i 's:^/::g' filelist
cd /
echo "${YELLOW}Tarring files to ${GREEN}"$BASEDIR"/package-"$PKGNAME".tar.gz${NORMAL}"
tar --no-recursion -T "$BASEDIR"/filelist -cpzf "$BASEDIR"/package-"$PKGNAME".tar.gz
fi
# Unpack package if desired to directory with the command:
# tar xvf package-(name).tar.gz -C /desired/directory
--- End code ---
vinnie:
even so I can't make it work
--- Code: ---tc@box:/tmp/inst$ bash ./installscript mkdir /tmp/provax
Tarring files to /tmp/inst/package-inst.tar.gz
tc@box:/tmp/inst$
tc@box:/tmp/inst$ ls -l
total 8
-rw-r--r-- 1 tc staff 0 Mar 28 12:16 filelist
-rwxr-xr-x 1 tc staff 2240 Mar 28 11:37 installscript
-rw-r--r-- 1 tc staff 45 Mar 28 12:16 package-inst.tar.gz
tc@box:/tmp/inst$ cat filelist
tc@box:/tmp/inst$
--- End code ---
I hope that someone else try it to determine if it's only my problem or generalized problem
Jason W:
It's tuned to ignore entries in /tmp, /dev, etc where you normally don't want to install files.
Adjust the EXCLUDE variable if needed.
vinnie:
Ok, Work!
--- Code: ---tc@box:/tmp/inst$ bash ./installscript mkdir /home/provax
mkdir: can't create directory '/home/provax': Permission denied
Tarring files to /tmp/inst/package-inst.tar.gz
tc@box:/tmp/inst$ ls -l
total 8
-rw-r--r-- 1 tc staff 0 Mar 28 15:55 filelist
-rwxr-xr-x 1 tc staff 2240 Mar 28 11:37 installscript
-rw-r--r-- 1 tc staff 45 Mar 28 15:55 package-inst.tar.gz
tc@box:/tmp/inst$ cat filelist
tc@box:/tmp/inst$
tc@box:/tmp/inst$ sudo bash ./installscript mkdir /usr/provax
Tarring files to /tmp/inst/package-inst.tar.gz
tc@box:/tmp/inst$ ls -l
total 12
-rw-r--r-- 1 root root 11 Mar 28 15:56 filelist
-rwxr-xr-x 1 tc staff 2240 Mar 28 11:37 installscript
-rw-r--r-- 1 root root 110 Mar 28 15:56 package-inst.tar.gz
tc@box:/tmp/inst$ cat filelist
usr/provax
tc@box:/tmp/inst$
--- End code ---
Also installwatch if i using /usr but its output is completely different from your showed me in other topic:
my output
--- Code: ---tc@box:/usr$ sudo bash installwatch mkdir -p dir/{1,2,3,4,5,7,8,9}
INFO : Using a default root directory : /tmp/tmp.zaXH03
tc@box:/usr$ sudo cat /tmp/tmp.zaXH03/logfile
0 mkdir /tmp/dir #success
0 mkdir /tmp/dir/{1,2,3,4,5,7,8,9} #success
--- End code ---
your
--- Code: ---0 mkdir /home/tc/dir #success
0 mkdir /home/tc/dir/1 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/2 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/3 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/4 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/5 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/7 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/8 #success
-1 mkdir /home/tc/dir #File exists
0 mkdir /home/tc/dir/9 #success
--- End code ---
and in fact changing your script and commenting EXCLUDE line what happens in the home is not monitored.
seems seriously that we have two different installwatch (but this is impossible!)
I probably will have to renounce, i will use find & diff.
I want to thank you anyway ;)
Jason W:
If you set EXCLUDE to an empty value rather than comment it, it monitors what happes in home, I just tried it. So it should work in that case.
--- Code: ---tc@box:~$ /mnt/hda2/installscript mkdir -p /home/tc/files
Tarring files to /tmp/tc/package-tc.tar.gz
tc@box:~$ cat /tmp/tc/filelist
home
home/tc
home/tc/files
tc@box:~$
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version