Closed jonjonw closed 9 years ago
I did not quite catch why you need this scripts, when you want to execute them and what are they doing? Can you post the example?
Sure, I'm going to try to re-write it to use patch files but here is what I was attempting:
/etc/customizepkg/sabnzbd
#!/bin/sh
PKGBUILD_FILE=$2
# Don't run the install file
sed -i '/install=/d' $PKGBUILD_FILE
# Use the new service file
#awk -i '/install.*service/ {sub("service", "service.new", $0)} {print}' $PKGBUILD_FILE
# Use /usr/lib/sabnzbd instead of /opt/sabnzbd
sed -i -e 's|opt/|usr/lib/|g' $PKGBUILD_FILE
# Create /var/lib/sabnzbd directory (with perms)
mv $PKGBUILD_FILE $PKGBUILD_FILE.oldtmp
cat $PKGBUILD_FILE.oldtmp \
| tac | sed '0,/\}/s//\}\n install -o nzbapps -g nzbapps -m755 -d \$pkgdir\/var\/lib\/\$pkgname/' \
| tac > $PKGBUILD_FILE
echo "options=(emptydirs)" >> $PKGBUILD_FILE
I added a file to /etc/customizepkg.d/sabnzbd.files/sabnzbd.service.new
When I run customizepkg, it appends this to the end of the script:
add#source#sabnzbd.service.new
add#md5#...
Which causes the script to fail.
pkg.files folder was created with the purpose to add extra files for the PKGBUILD to be used in package making, but not for the package-time script. Another question - why can't you use customizepkg syntax to do the job (as expected) but instead trying to update PKGBUILD using awk and sed? Customizepkg commands were created exactly with aim of avoiding scripting for PKGBUILD update - just declarative-style description of what to do + extra files to add from pkg.files folder. Looks like you are misusing customizepkg here.
That would be my preference. I don't see a way to append a line to the end of the package() {} function so I figured I would write a script for it. Unfortunately, that means that I have to mark the config as executable and the entire file gets interpreted as a script and I can no longer use the cusomizepkg syntax.
Adding something like /etc/customizepkg.d/pkg.scripts would allow me to use both the customizepkg syntax as well as a script rather than having to chose just one and do a ton of work with sed.
If there was a customizepkg command like: add#package()#install -o nzbapps -g nzbapps -m755 -d $pkgdir/var/lib/$pkgname/
that would append that line to the end of the package(){} function, it would be awesome but I think writing that functionality would be a nightmare unless you find a way to leverage the parser in bash.
Would it be possible to support patch files for the PKGBUILD file? Maybe you could add a command like: patchpkgbuild#1#file.patch
Merged pull request with PKGBUILD patch support. Closing this issue now.
When I add files in /etc/customizepkg.d/pkg.files, they get appended to pkg.customize. When the script is executable, these instructions are not interpreted correctly.
Just as a suggestion, why not add another directory for scripts.
ie: /etc/customizepkg.d/pkg.scripts which would contain scripts that would be run in alphanumeric order? Then I could make /etc/customizepkg.d/pkg not executable and place my script(s) in that directory and still get the files and customizepkg syntax in the main file.