Rename prepost-{inst,rm} to just INSTALL/REMOVE.
Some other changes related for this: - Modify binpkg.sh to always insert the INSTALL script at head of the archive, and appending files after it. - Modify binpkg.sh to compress binpkgs with bzip2 -9 to save some bytes. --HG-- extra : convert_revision : b651b944f11c48dede1bbcea658182bf0984e8f3
This commit is contained in:
parent
a0ee2ee61b
commit
a00ae944b5
|
@ -13,8 +13,8 @@ with bzip2 and has the following structure:
|
|||
/var/db/xbps/metadata/$pkgname
|
||||
/var/db/xbps/metadata/$pkgname/flist
|
||||
/var/db/xbps/metadata/$pkgname/props.plist
|
||||
/var/db/xbps/metadata/$pkgname/prepost-inst
|
||||
/var/db/xbps/metadata/$pkgname/prepost-rm
|
||||
/var/db/xbps/metadata/$pkgname/INSTALL
|
||||
/var/db/xbps/metadata/$pkgname/REMOVE
|
||||
|
||||
Metadata info is stored in the "/var/db/xbps/metadata/$pkgname"
|
||||
directory and two files will be always be present: flist and props.plist.
|
||||
|
@ -61,7 +61,7 @@ has the following structure:
|
|||
...
|
||||
</dict>
|
||||
|
||||
The prepost-* executables allows you to trigger any action
|
||||
The INSTALL/REMOVE executables allows you to trigger any action
|
||||
at pre/post installation/removal of the binary package.
|
||||
|
||||
The package's dictionary will also be written into the repository's package
|
||||
|
|
11
lib/remove.c
11
lib/remove.c
|
@ -189,21 +189,20 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags)
|
|||
return ENOENT;
|
||||
|
||||
/*
|
||||
* This length is '%s%s/metadata/%s/prepost-rm' not
|
||||
* including nul.
|
||||
* This length is '%s%s/metadata/%s/REMOVE' + NULL.
|
||||
*/
|
||||
len = strlen(XBPS_META_PATH) + strlen(destdir) + strlen(pkgname) + 22;
|
||||
buf = malloc(len + 1);
|
||||
len = strlen(XBPS_META_PATH) + strlen(destdir) + strlen(pkgname) + 19;
|
||||
buf = malloc(len);
|
||||
if (buf == NULL)
|
||||
return errno;
|
||||
|
||||
if (snprintf(buf, len + 1, "%s%s/metadata/%s/prepost-rm",
|
||||
if (snprintf(buf, len, "%s%s/metadata/%s/REMOVE",
|
||||
destdir, XBPS_META_PATH, pkgname) < 0) {
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Find out if the prepost-rm file exists */
|
||||
/* Find out if the REMOVE file exists */
|
||||
if ((fd = open(buf, O_RDONLY)) == -1) {
|
||||
if (errno != ENOENT) {
|
||||
free(buf);
|
||||
|
|
11
lib/unpack.c
11
lib/unpack.c
|
@ -151,7 +151,7 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
|
|||
struct archive_entry *entry;
|
||||
struct stat st;
|
||||
size_t len;
|
||||
const char *prepost = "./XBPS_PREPOST_INSTALL";
|
||||
const char *prepost = "./INSTALL";
|
||||
const char *pkgname, *version;
|
||||
char *buf, *path;
|
||||
int rv = 0, lflags = 0;
|
||||
|
@ -169,15 +169,14 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
|
|||
lflags = EXTRACT_FLAGS;
|
||||
|
||||
/*
|
||||
* This length is '.%s/metadata/%s/prepost-inst' not
|
||||
* including nul.
|
||||
* This length is '.%s/metadata/%s/INSTALL' + NULL.
|
||||
*/
|
||||
len = strlen(XBPS_META_PATH) + strlen(pkgname) + 24;
|
||||
buf = malloc(len + 1);
|
||||
len = strlen(XBPS_META_PATH) + strlen(pkgname) + 20;
|
||||
buf = malloc(len);
|
||||
if (buf == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
if (snprintf(buf, len + 1, ".%s/metadata/%s/prepost-inst",
|
||||
if (snprintf(buf, len, ".%s/metadata/%s/INSTALL",
|
||||
XBPS_META_PATH, pkgname) < 0) {
|
||||
free(buf);
|
||||
return -1;
|
||||
|
|
|
@ -225,15 +225,13 @@ _EOF
|
|||
chmod 644 $metadir/*
|
||||
rm -f $TMPFLIST $TMPFPLIST $TMPFPROPS
|
||||
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/prepost-inst" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/prepost-inst \
|
||||
$destdir/XBPS_PREPOST_INSTALL
|
||||
chmod +x $destdir/XBPS_PREPOST_INSTALL
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/INSTALL" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/INSTALL $destdir
|
||||
chmod +x $destdir/INSTALL
|
||||
fi
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/prepost-rm" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/prepost-rm \
|
||||
$metadir/prepost-rm
|
||||
chmod +x $metadir/prepost-rm
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/REMOVE" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/REMOVE $metadir
|
||||
chmod +x $metadir/REMOVE
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -285,7 +283,22 @@ xbps_make_binpkg_real()
|
|||
binpkg=$pkgname-$version.$arch.xbps
|
||||
pkgdir=$XBPS_PACKAGESDIR/$arch
|
||||
|
||||
run_rootcmd $use_sudo tar cfjp $XBPS_DESTDIR/$binpkg .
|
||||
if [ -x ./INSTALL ]; then
|
||||
#
|
||||
# Make sure that INSTALL is the first file on the archive,
|
||||
# this is to ensure that it's run before any other file is
|
||||
# unpacked.
|
||||
#
|
||||
run_rootcmd $use_sudo tar cfp $XBPS_DESTDIR/$binpkg ./INSTALL && \
|
||||
run_rootcmd $use_sudo tar rfp $XBPS_DESTDIR/$binpkg . \
|
||||
--exclude "./INSTALL" && \
|
||||
run_rootcmd $use_sudo bzip2 -9 $XBPS_DESTDIR/$binpkg && \
|
||||
mv $XBPS_DESTDIR/$binpkg.bz2 $XBPS_DESTDIR/$binpkg
|
||||
else
|
||||
run_rootcmd $use_sudo tar cfp $XBPS_DESTDIR/$binpkg . && \
|
||||
bzip2 -9 $XBPS_DESTDIR/$binpkg && \
|
||||
mv $XBPS_DESTDIR/$binpkg.bz2 $XBPS_DESTDIR/$binpkg
|
||||
fi
|
||||
# Disabled for now.
|
||||
# --exclude "./var/db/xbps/metadata/*/flist" .
|
||||
#
|
||||
|
|
|
@ -47,7 +47,7 @@ case "$2" in
|
|||
pre)
|
||||
;;
|
||||
post)
|
||||
echo "Running $3-$4 post installation hook..."
|
||||
echo "Running $3-$4 post installation hooks..."
|
||||
if [ "$1" = "NOTSET" ]; then
|
||||
run_cmd="pwconv"
|
||||
else
|
Loading…
Reference in New Issue