Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 15 Nov 2019, 22:58
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
woof-CE patch generator!
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [44 Posts]   Goto page: 1, 2, 3 Next
Author Message
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Thu 16 Apr 2015, 03:12    Post subject:  woof-CE patch generator!  

This is primarily for woof-CE puppy and puplet builders, but could also help anyone with some basic understanding and willing to contribute to woof-CE

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. Wink
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" ( Twisted Evil ), is not.

So without further ado, here is the script
Code:
#!/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

Copy it to a file, make it executable, place it in the directory that also contains your woof-CE git, and run it with or without the sfs argument.
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.
make_woofCE_patches.sh.gz
Description  version 0.7
gz

 Download 
Filename  make_woofCE_patches.sh.gz 
Filesize  1.59 KB 
Downloaded  282 Time(s) 

_________________
== Here is how to solve your Linux problems fast ==

Last edited by mavrothal on Sun 18 Oct 2015, 01:42; edited 17 times in total
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Thu 16 Apr 2015, 04:05    Post subject:  


_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8730
Location: qld

PostPosted: Thu 16 Apr 2015, 07:42    Post subject:  

Sticky this one please Flash or it may get lost in the wash.
_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
ASRI éducation


Joined: 09 May 2009
Posts: 3203
Location: France

PostPosted: Thu 16 Apr 2015, 08:48    Post subject:  

This utility is a real good idea!
_________________
Projet ASRI éducation => Association | Forum | Dépôt | Espace kids
Back to top
View user's profile Send private message Visit poster's website 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Thu 16 Apr 2015, 12:01    Post subject:  

I revised the initial script a bit to version 0.2.
Add some more checks and organize some patches into folders for easier reviewing.

One "conceptual" problem I have if I should make it more automatic. ie instead of providing warning to actually get/fix whatever is needed. Also instead of a flat text file, supply it as a pet.
This may make it simple for anyone to use but at the same time is likely to generate a lot of irrelevant info instead of useful patches (running it against my local Tahr version it generates over 300 patches Shocked).
Any thoughts on this?

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 12837
Location: S.C. USA

PostPosted: Fri 17 Apr 2015, 21:55    Post subject:  

If this really works and the developers will really support it.
Great idea.

Quote:
running it against my local Tahr version it generates over 300 patches Shocked).
Any thoughts on this?

There has been a lot of bug fixes in Tahrpup 6.0 CE since it was first released.

Any of what you are seeing got to do with any of these?

05/04/2015 added radkys fbbox to quickpet
04/04/2015 fix for shutdownconfig ...rerwin & mavrothal
04/04/2015 fix for rc.shutdown ...gyro
30/03/2015 fix for Keyboard layout variant reseting after reboot ....dustedwax & bigpup
30/03/2015 fixed missing icons in file choosers ...ninaholic
30/03/2015 added findnrun ...SFR
30/03/2015 updated getflash ...ASRI éducation
22/03/2015 updated pupclockset, urxvtcontrol & pupsysinfo ...radky
21/03/2015 updated openssl & libssl
21/03/2015 google music manager in quickpet needed libqtwebkit ...aleoleilani & sonny
18/03/2015 added sticky-jwm in destop menu ....recobayu
18/03/2015 added puppylinux search plugin to palemoon (find in menu in search bar)....Geoffrey
14/03/2025 updated PPM to 2 ...mavrothal
11/03/2015 add clear search field button in PPM ...mavrothal
07/03/2015 updated PPM to 2.0 ...mavrothal
05/03/2015 getflash broken as adobe changed url ...barry k
02/03/2015 updated PPM to 1.9.7 ...mavrothal
02/03/2015 changed pidgin package in quickpet as previous one would not connect to google
01/03/2015 added evince-previewer symlink for gnumeric....charlie6
01/03/2015 updated PPM to 1.9.6 ...mavrothal
23/02/2015 updated 7z & rar wrappers for xarchive that give warning when trying to extract encrypted files (problem in 6.0 only) ...dustedwax & SFR
20/02/2015 updated video_upgrade_wizard
20/02/2015 added graphic drivers for tahrpup6.0.2
19/02/2015 fix /usr/share/icons/hicolcor spelling mistake ....Hesse James
19/02/2015 updated pidgin in quickpet ... vicmz
19/02/2015 added pgprs ... rerwin
19/02/2015 hacks-postinstall.sh google-chrome, added 'chmod 755 /initrd/pup_rw' as google-chrome messes with permissions, this fixes the cups problem but there may still be other issues
15/02/2015 added missing samba tng menu entry
13/02/2015 fix for radio4 in pup radio
13/02/2015 updated to latest PPM 1.9.5 ...mavrothal & zigbert
11/02/2015 added fixes for chrome, iron & kde to hacks-postinstall (note that google chrome messes up file folder permissions!)
11/02/2015 updated to latest PPM ...mavrothal & zigbert

the following are in servicepack 6.0 - 6.0.2

11/02/2015 added webchemy browser art
11/02/2015 added droid font
11/02/2015 added urxvt control ..radky
11/02/2015 updated pfind ...zigbert
11/02/2015 updated PPM ....thanks mavrothal & zigbert
11/02/2015 added update-mime-database for kde apps
11/02/2015 now a single update button in quickpet
11/02/2015 added wmctrl
11/02/2015 added p7zip full
11/02/2015 updated uxtract and packit ...sfr
20/01/2015 sfsget, new scrollable and resizable gui ...'keyboard' http://murga-linux.com/puppy/viewtopic.php?p=822501#822501
20/01/2015 openssl & libssl updated to latest patched versions
17/01/2015 add srpos plugin for vlc to remember playback position
17/01/2015 added ca-certificates
16/01/2015 removed defunct unrar right click option ...dancytron
12/01/2015 sfs_load failed to grab urls ...Geoffrey
11/01/2015 alsamixer was exiting when pressing funtion keys, added script .... charlie6
08/01/2015 added vlc tunein radio plugin (hundreds of radio stations for vlc open vlc, click on 'view' then 'playlist' , scroll down to the internet section on the left and select TuneIn Radio. )
08/01/2015 xlock internationalized ...barry k & bigpup
07/01/2015 added https handler for xdg-open (needed by some apps)
07/01/2015 fixed spelling mistake in keyboard wizard ....Lefty Mills
26/12/2014 updated yassm .....augras
21/12/2014 fix for sfsget ..... packages got with sfsget weren't loading
18/12/2014 udev error messages ..edited rules and added libgphoto utopic ...wyzguy
17/12/2014 added right click set wallpaper
17/12/2014 added new tahrpup backgrounds ....futwerk
17/12/2014 added new gtk & jwm themes ...vicmz & CMB27
17/12/2014 drive_all improvements ...jlst
17/12/2014 update for quickpet
17/12/2014 added packit and UExtract ...SFR (these were meant to be in the iso)
17/12/2014 fix to remember screen brightness setting
17/12/2014 updated rox-filer, fixes quiet copy bug and proc bug
14/12/2014 input wizard fix. couldn't switch back to right handed mouse ...MochiMoppel & bigpup
14/12/2014 drive_all fix improve vcd detection ...jlst
26/11/2014 updated planner ...Cadejo
26/11/2014 fixed video upgrade wizard ...bigpup
26/11/2014 brightened up network tray icon ...rek769
21/11/2014 changed to rarings syslinux as installed one causing problems ...gjuhasz & rcrsn51
21/11/2014 drive_all fix improve dvd disc detection ...jlst
21/11/2014 sound card sometimes not initialised on slow computers, added script in /root/Startup/alsa ...jlst
21/11/2014 PPM said libqtwebkit was installed when not
21/11/2014 palemoon updater
16/11/2014 partview, top, startup-control and menumanager had nodisplay=true set in their .desktop files
16/11/2014 default audio player set to /opt/deadbeef/deadbeef instead of /usr/bin/deadbeef
14/11/2014 burniso2cd was missing menu entry ...Len E
13/11/2014 defaults-chooser spelling mistake in script line 204 ...bigpup
13/11/2014 deadbeef not working from terminal, made launcher script ...augras
13/11/2014 cups-pdf updated, older buggy one accidently in tahr ...rcrsn51
13/11/2014 icon switcher wrong url to forum ...bigpup
13/11/2014 jwm theme maker updated ...trio
13/11/2014 wakeupbug, fixes usb devices not working after suspend to ram...wyzguy
13/11/2014 perl errors in terminal, added a few lines to /root/.Xdefaults, this stops the tabs though
13/11/2014 libblas & liblapack symlinks, they needed symlinking /usr/lib as that's were they are looked for
01/11/2014 updated wget ... security issue
30/10/2014 legacy grub was missing ...ghead & rcrsn51
30/10/2014 added gnumeric help ...bigpup & peebee
30/10/2014 added sylpheed help ...peebee
30/10/2014 added mtpaint help ...bigpup
28/10/2014 added missing dir2targz right click
28/10/2014 going back to older pburn as newest missing dependencies ..bigpup & zigbert
27/10/2014 remasterpup2 fix for remastering with save to folder ...mavrothal
27/10/2014 pcur.desktop wasn't showing in menu ..bigpup & geoffrey
27/10/2014 getnvidia link in quickpet ..bigpup
27/10/2014 grub4dos menu entry ..bigpup

_________________
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
YaPI(any iso installer) http://www.murga-linux.com/puppy/viewtopic.php?t=107601
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Sat 18 Apr 2015, 00:27    Post subject:  

bigpup wrote:
If this really works and the developers will really support it.
Great idea.

Quote:
running it against my local Tahr version it generates over 300 patches Shocked).
Any thoughts on this?

There has been a lot of bug fixes in Tahrpup 6.0 CE since it was first released.

Any of what you are seeing got to do with any of these?

Why don't you run the script and let us know Wink

BTW it can also work the other way around. To update your build with the latest in woof-CE. You must certainly backup your savefile/folder, before you try such a thing and be sure you understand what the patches do as many regard setting that are changed at build or runtime!
It should be useful for a puppy builder/developer or an "advanced" user, but certainly not for most.

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6606
Location: Valåmoen, Norway

PostPosted: Sat 18 Apr 2015, 01:39    Post subject:  

thumbs up
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Sat 18 Apr 2015, 10:23    Post subject:  

Version 0.3 of the script also looks and compares with "rootfs-packages" files.
Currently this folder has just a couple of packages but hopefully many of the "noarch" scripts that are populating almost every puppy could be moved and maintained there Wink

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
keyboard


Joined: 30 Nov 2014
Posts: 148

PostPosted: Sun 19 Apr 2015, 18:59    Post subject: Great utility  

I was looking for something exactly like this Very Happy great utility Smile
Back to top
View user's profile Send private message 
keyboard


Joined: 30 Nov 2014
Posts: 148

PostPosted: Sun 19 Apr 2015, 19:52    Post subject:  Where is 'if'??
Subject description: and also 'fi' ?
 

where is 'if' and 'fi' in the script ?? Shocked

version 0.4 ?? lol

Code:

#!/bin/sh
# A script to generate woof-CE patches against a running puppy.

Version=0.4

. /etc/DISTRO_SPECS
# 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." exit 1
fi

WDIR=$(pwd)

if [ ! -d $WDIR/woof-CE ]; then
   Xdialog --title "Error" --msgbox "This script should be in the same folder as the woof-CE git folder" 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 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 'git pull --all'" exit 1
fi

# Make the patches
[ "$BUILD_FROM_WOOF" ] && FROMWOOF=_$(echo $BUILD_FROM_WOOF | cut -f 2 -d ';' | cut -c 1-6)
PATCHES=woof_${GIT_BRANCH}${GIT_HEAD}_patches_to_$DISTRO_FILE_PREFIX-$DISTRO_VERSION$FROMWOOF
COMP_DIR= #You could compare to any dir but the sed commands below need adjustment
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
 [ "$(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\//" *
 sed -i "s/\+\+\+\ \/\.\//\+\+\+\ b\/woof\-code\/$DS\//" *
done
# Move some patches to folders for easy reviewing
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}.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
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Mon 20 Apr 2015, 00:49    Post subject: Re: Where is 'if'??
Subject description: and also 'fi' ?
 

keyboard wrote:
where is 'if' and 'fi' in the script ?? Shocked

Version=0.4

"[ condition ] &&" is acceptable I believe and shorter Wink
Any other changes to justify version bump?

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
keyboard


Joined: 30 Nov 2014
Posts: 148

PostPosted: Mon 20 Apr 2015, 02:15    Post subject:  

lol , no it was causing problems for me:

look :-

Code:
 
root# ./patch_check.sh
./patch_check.sh: line 9: Please install the devx sfs or just git from the repo.: command not found
./patch_check.sh: line 10: syntax error near unexpected token `&&'
./patch_check.sh: line 10: ` && exit 1 '


after using if - fi .. the output is in the image...

although there might be something else missing here too ...hmmm...
capture21826.png
Description 
png

 Download 
Filename  capture21826.png 
Filesize  101.94 KB 
Downloaded  482 Time(s) 
Back to top
View user's profile Send private message 
keyboard


Joined: 30 Nov 2014
Posts: 148

PostPosted: Mon 20 Apr 2015, 02:43    Post subject:  

oh yes.. I had to edit line too...

Code:

if [ "$(which git)" != "" ];then


to

Code:

if [ "$(which git)" == "" ];then


hence the script:

Code:

#!/bin/sh
# A script to generate woof-CE patches against a running puppy.

Version=0.4 #maybe ??

. /etc/DISTRO_SPECS
# 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." exit 1
fi

WDIR=$(pwd)

if [ ! -d $WDIR/woof-CE ]; then
   Xdialog --title "Error" --msgbox "This script should be in the same folder as the woof-CE git folder" 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 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 'git pull --all'" exit 1
fi

# Make the patches
[ "$BUILD_FROM_WOOF" ] && FROMWOOF=_$(echo $BUILD_FROM_WOOF | cut -f 2 -d ';' | cut -c 1-6)
PATCHES=woof_${GIT_BRANCH}${GIT_HEAD}_patches_to_$DISTRO_FILE_PREFIX-$DISTRO_VERSION$FROMWOOF
COMP_DIR= #You could compare to any dir but the sed commands below need adjustment
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
 [ "$(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\//" *
 sed -i "s/\+\+\+\ \/\.\//\+\+\+\ b\/woof\-code\/$DS\//" *
done
# Move some patches to folders for easy reviewing
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}.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
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3076

PostPosted: Mon 20 Apr 2015, 04:29    Post subject:  

keyboard wrote:
lol , no it was causing problems for me:

look :-

Code:
 
root# ./patch_check.sh
./patch_check.sh: line 9: Please install the devx sfs or just git from the repo.: command not found
./patch_check.sh: line 10: syntax error near unexpected token `&&'
./patch_check.sh: line 10: ` && exit 1 '


after using if - fi .. the output is in the image...

although there might be something else missing here too ...hmmm...


This is more likely because you deleted (?) the backslash escape character ("\") at the end of line 8. Lines 8, 9 and 10 are actually 1 line and the escape character instructs the script to ignore the following carriage return/newline.
This is a way to avoid the long and hard to read lines (even if they are very common in puppy Very Happy ) but if you miss them you run into trouble.

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [44 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0816s ][ Queries: 12 (0.0101s) ][ GZIP on ]