These scripts are used for creating and managing Tiny Core extensions. Other version trackers (git, svn, etc) don't preserve permissions which is necessary for extensions. I recommend using them within a Tiny Core enviroment, it makes keeping the permissions straight much easier. These scripts will also use sudo to bump up permissions from tc to root (necessary if a file in the extension is owned by root) so they will most likely not work in other distros anyways.
Until this sentence is removed this is a work in progress! Some work still needs to be done to make them more portable. Use at your own risk!
These scripts run inside the directory with your raw extensions.
mkdir extensions cd extensions mkdir built mkdir changelog mkdir backup wget http://url/to/mkext #these will be updated later wget http://url/to/mkcln wget http://url/to/mkchk chmod +x mkext mkcln mkchk
This script will backup the old version of the extension, add all comments to the change log and then build the extension.
EXT=`echo $1 | sed 's/\///'` shift FILE="$EXT/usr/local/tce.installed/$EXT" DIR="$EXT/usr/local/tce.installed" DATE=`date +%y.%m.%d_%H.%M` MOD_FLAG="# MODIFIED:" VER_FLAG="# VERSION:" if [ -d $EXT -a $EXT ] then if [ -z $1 ] then echo "Please type a comment to describe recent changes!" else if [ ! -f $FILE ] then if [ ! -d $DIR ] then sudo mkdir -p $DIR fi echo "$VER_FLAG 1" | sudo tee $FILE > /dev/null echo "$MOD_FLAG $DATE" | sudo tee -a $FILE > /dev/null fi MOD_EXISTS=`cat $FILE | grep "$MOD_FLAG" | wc -l` if [ $MOD_EXISTS -eq 0 ] then sudo sed -i "1i $MOD_FLAG $DATE" $FILE else OLD_DATE=`cat $FILE | grep "$MOD_FLAG " | sed "s/$MOD_FLAG //"` sudo sed -i "s/$MOD_FLAG $OLD_DATE/$MOD_FLAG $DATE/" $FILE fi VER_EXISTS=`cat $FILE | grep "$VER_FLAG" | wc -l` if [ $VER_EXISTS -eq 0 ] then sudo sed -i "1i $VER_FLAG 1" $FILE else OLD_VER=`cat $FILE | grep "$VER_FLAG " | sed "s/$VER_FLAG //"` NEW_VER=$((OLD_VER+1)) sudo sed -i "s/$VER_FLAG $OLD_VER/$VER_FLAG $NEW_VER/" $FILE fi mv built/$EXT.tcz backup/$EXT\-$DATE.tcz mksquashfs $EXT built/$EXT.tcz > /tmp/mkext_out fi else echo "Specified extension does not exist!" fi #if [ ! -f changelog/$EXT ] #then #touch changelog/$EXT #fi echo "Version $NEW_VER" >> changelog/$EXT echo $DATE >> changelog/$EXT echo $@ >> changelog/$EXT
Compares the raw extension files to the last committed version.
EXT=`echo $@ | sed 's/\///'` if [ -z $EXT ] then echo "Please specify an extension!" else mkdir /tmp/$EXT sudo mount -o loop built/$EXT\.tcz /tmp/$EXT diff /tmp/$EXT $EXT FILES=`find $EXT -type f` for n in $FILES do diff -a /tmp/$n $n done sudo umount -d /tmp/$EXT rmdir /tmp/$EXT fi
Reverts raw extension files to the last committed version.
EXT=`echo $@ | sed 's/\///'` DATE=`date +%y.%m.%d_%H.%M` if [ -z $EXT ] then echo "Please specify an extension!" else mv $EXT .cleaned/$EXT\-$DATE mkdir /tmp/$EXT sudo mount -o loop built/$EXT\.tcz /tmp/$EXT sudo cp -rp /tmp/$EXT $EXT sudo umount -d /tmp/$EXT rmdir /tmp/$EXT fi