Quite often changes are making it into woof-CE-build puppies that are "manual". ie changed into the final ISO root but not in the woof-CE repo. They are often "forgotten" and hard to trace at a latter point and do the corresponding changes in woof-CE, for the puppies to come.
So I made a script that will detect any changes in the testing branch of the woof-CE rootfs-skeleton code against a running puppy or the unmodified puppy SFS (when run with the "sfs" argument) and will create individual patches for each changed woof-CE file. These patches can be directly applied to the woof-CE git.
If you decide to do so please check the individual patches to make sure that are not kernel- or binary-compatibility-distro-specific.
Submit pull requests to woof-CE with individual or closely related patches. ie patches related "pup_event" is OK to go in one pull request. Patches to the (/usr, /lib, etc, folder of) "my_Super_puppy-007.iso" ( ), is not.
So without further ado, here is the script
Code: Select all
#!/bin/bash
# A script to generate woof-CE patches against a running puppy (run without
# any arguments) or the puppy.sfs (run with the 'sfs' argument).
Version=0.7
. /etc/DISTRO_SPECS
. /etc/rc.d/PUPSTATE
# Check if we are good to run
if [ "$(which git)" = "" ]; then
Xdialog --title "Error" --msgbox \
"Please install the devx sfs or just git from the repo." 0 0
exit 1
fi
WDIR=$(pwd) # Should be just above your freshly cloned woof-CE git
if [ ! -d $WDIR/woof-CE ]; then
Xdialog --title "Error" --msgbox \
"This script should be in the same folder as the woof-CE git folder" 0 0
exit 1
fi
GIT_BRANCH=$(cut -f3 -d'/' $WDIR/woof-CE/.git/HEAD)
if [ ! "$GIT_BRANCH" ]; then
Xdialog --title "Error" --msgbox \
"The woof-CE folder is not a git repo. Please clone the woof-CE git" 0 0
exit 1
fi
if [ "$GIT_BRANCH" != "testing" ]; then
Xdialog --title "Error" --msgbox \
"Your woof-CE repo is not in the testing branch. Please run 'git checkout testing'" 0 0
exit 1
fi
GIT_HEAD=$(cut -c 1-6 $WDIR/woof-CE/.git/refs/heads/testing)
REMOTE_HEAD=$(git ls-remote https://github.com/puppylinux-woof-CE/woof-CE.git |
grep 'refs/heads/testing' | cut -c 1-6)
if [ "$REMOTE_HEAD" != "$GIT_HEAD" ]; then
Xdialog --title "Error" --msgbox \
"Your local repo is not in sysnc with the remote. Please run 'git pull --all'" 0 0
exit 1
fi
if [ "$1" = "sfs" -a "$PUPMODE" = "2" ]; then
Xdialog --title "Error" --msgbox \
"There is no pup.sfs in full installs. Please run without the 'sfs' argument" 0 0
exit 1
fi
# Make the patches
[ "$BUILD_FROM_WOOF" ] && FROMWOOF=_$(echo $BUILD_FROM_WOOF | cut -f 2 -d ';' | cut -c 1-6)
case "$1" in
sfs) COMP_DIR=/initrd/pup_ro2
PATCHES=woof_"$GIT_BRANCH""$GIT_HEAD"_patches_to_"$DISTRO_FILE_PREFIX"-"$DISTRO_VERSION"_sfs"$FROMWOOF"
;;
*) COMP_DIR=
PATCHES=woof_"$GIT_BRANCH""$GIT_HEAD"_patches_to_"$DISTRO_FILE_PREFIX"-"$DISTRO_VERSION""$FROMWOOF"
;;
esac
mkdir -p $WDIR/$PATCHES
rm -rf $WDIR/$PATCHES/*
DIRS=rootfs-skeleton
for i in $(ls woof-CE/woof-code/rootfs-packages/)
do
DIRS="$DIRS rootfs-packages/$i"
done
for D in $DIRS
do
FOLDER=woof-CE/woof-code/$D
cd $WDIR/$FOLDER
for f in $(find ./ -type f)
do
[ -f $COMP_DIR/$f ] && [ "$(diff -u -N $f $COMP_DIR/$f)" != "" ] \
&& diff -u -N $f $COMP_DIR/$f > $WDIR/$PATCHES/$(basename $f).patch
done
#exit 0 #Uncomment to check if compared correctly
cd $WDIR/$PATCHES
DS="$(echo $D | sed 's/\//\\\//')"
sed -i "s/\-\-\-\ \.\//\-\-\-\ a\/woof\-code\/$DS\//" *
if [ "$1" = "sfs" ]; then
sed -i "s/\+\+\+\ \/initrd\/pup_ro2\/\.\//\+\+\+\ b\/woof\-code\/$DS\//" *
else
sed -i "s/\+\+\+\ \/\.\//\+\+\+\ b\/woof\-code\/$DS\//" *
fi
done
# check init
INITPATH=$(echo "$PUPSFS" | cut -f 2 -d '/' | grep -v sfs)
mkdir -p /tmp/initfs
cd /tmp/initfs
gunzip -c /mnt/home/$INITPATH/initrd.gz | cpio -i
cd $WDIR/woof-CE/woof-code
HUGEINIT=$(ls /mnt/home/$INITPATH/*.sfs | grep -s zdrv)
if [ "$HUGEINIT" != "" ]; then
diff -u huge_extras/init /tmp/initfs/init > $WDIR/$PATCHES/init.patch
sed -i "s/\-\-\-\ /\-\-\-\ a\/\woof\-code\//" $WDIR/$PATCHES/init.patch
sed -i "s/\+\+\+\ \/tmp\/initfs/\+\+\+\ b\/woof\-code\/huge_extras/" $WDIR/$PATCHES/init.patch
else
diff -u boot/initrd-tree/init /tmp/initfs/init > $WDIR/$PATCHES/init.patch
sed -i "s/\-\-\-\ /\-\-\-\ \woof\-code\//" $WDIR/$PATCHES/init.patch
sed -i "s/\+\+\+\ \/tmp\/initfs/\+\+\+\ b\/woof\-code\/boot\/initrd\-tree0/" $WDIR/$PATCHES/init.patch
fi
rm -rf /tmp/initfs
# Move some patches to folders for easy reviewing
cd $WDIR/$PATCHES
mkdir binary_files SVGs defaults docs running desktop
for f in $( grep ^Binary * | cut -f 1 -d':')
do
mv $f binary_files/
done
mv *.svg.patch SVGs/
mv default*.patch defaults/
mv *.rules.patch running/
mv {PUPSTATE,BOOTCONFIG,clock,current_month,issue,hosts,hostname,ld.so.conf,resolv.conf,profile}.patch running/
mv *.{htm,html,css,txt}.patch docs/
mv *.html.*.patch docs/
mv *.desktop.patch desktop/
rm -f messages.patch
cd $WDIR
# exit 0 #Uncomment to review if patches are OK FOR woof-CE
rm -f $WDIR/$PATCHES.tar.gz
tar cvzf $PATCHES.tar.gz $PATCHES/
exit 0
If everything goes to plan should generate a folder with the patches and a tarball of this folder. The name should be indicative of your git state and your puppy name.