#!/bin/bash # Create a log of all the files for the package and a list of all pkgs that the current pkg links to source `which ttPM-funcs` 2>/dev/null || exit 1 # For root store files in home directory if [ $UID -eq 0 ] then install -d $TT_ROOT_DATA_DIR FILE=$TT_ROOT_DATA_DIR/files DIR=$TT_ROOT_DATA_DIR/dirs else install -d $TT_PKG_LOCAL_DATA_DIR FILE=$TT_PKG_LOCAL_DATA_DIR/files DIR=$TT_PKG_LOCAL_DATA_DIR/dirs fi printMsg info "Compiling list of pkg files..." #printMsg info "Saving list of package files in $FILE..." find $TT_PKG_DIRS \( -user $TT_PKG_USERNAME -or -group $TT_PKG_USERNAME \) -and \( -type f -or -type l \) 2> /dev/null | sort > $FILE 2> /dev/null #printMsg info "Saving list of package dirs in $DIR..." find $TT_PKG_DIRS \( -user $TT_PKG_USERNAME -or -group $TT_PKG_USERNAME \) -and -type d 2> /dev/null | sort > $DIR 2> /dev/null if [ $UID -ne 0 ] then TMPFILE=`mktemp` LIB=$TT_PKG_LOCAL_DATA_DIR/libs TRACE=$TT_PKG_LOCAL_DATA_DIR/trace DEP=$TT_PKG_LOCAL_DATA_DIR/deps MANUAL_PKG_DEPS="" if [ -f $TT_PKG_DATA_DIR/manualDeps ] then MANUAL_PKG_DEPS=$TT_PKG_DATA_DIR/manualDeps fi if [ -f $TT_PKG_LOCAL_DATA_DIR/manualDeps ] then MANUAL_PKG_DEPS=$TT_PKG_LOCAL_DATA_DIR/manualDeps fi #printMsg info "Saving list of linked libraries for ${TT_PKG_NAME} in ${LIB}..." findLinkedLibs "$FILE" > $LIB #printMsg info "Saving list of traced execs for ${TT_PKG_NAME} in ${TRACE}..." TRACEFILES="`ls ${HOME}/tracefile.* 2>/dev/null`" if [ ! -z "$TRACEFILES" ] then cat $TRACEFILES | grep execve | cut -d \" -f 2 | sort | uniq > $TMPFILE > $TRACE for E in $(cat $TMPFILE) do if [ -f "$E" ] then echo "$E" >> $TRACE fi done else touch $TRACE fi #printMsg info "Saving list of dependencies for ${TT_PKG_NAME} in ${DEP}..." for D in $(cat $LIB $DEP) do find $D -printf "%u\n%g\n" done 2>/dev/null > $TMPFILE cat $TMPFILE $MANUAL_PKG_DEPS 2>/dev/null | sort | uniq | grep -vx ${TT_PKG_USERNAME} | grep -vx root | grep -vx "$TT_PKG_USER" > $DEP # Clean the tmp file rm -f $TMPFILE # Create links to $PKG_VAR ln -sf $LIB $TT_LIB_FILES_DIR/$TT_PKG_USERNAME ln -sf $TRACE $TT_TRACE_FILES_DIR/$TT_PKG_USERNAME ln -sf $DEP $TT_DEP_FILES_DIR/$TT_PKG_USERNAME fi