Add the prepost-action script into the binary package if exists.
--HG-- extra : convert_revision : 3d1db89a9347d423550984e7ff5c941d0d7b6cbe
This commit is contained in:
parent
5d3e701b3a
commit
78b036f346
2 changed files with 15 additions and 8 deletions
|
@ -265,6 +265,7 @@ xbps_unpack_archive_cb(struct archive *ar, const char *pkgname)
|
||||||
{
|
{
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
const char *prepost = "./XBPS_PREPOST_ACTION";
|
||||||
char *buf;
|
char *buf;
|
||||||
int rv = 0, flags;
|
int rv = 0, flags;
|
||||||
bool actgt = false;
|
bool actgt = false;
|
||||||
|
@ -294,13 +295,16 @@ xbps_unpack_archive_cb(struct archive *ar, const char *pkgname)
|
||||||
* Run the pre installation action target if there's a script
|
* Run the pre installation action target if there's a script
|
||||||
* before writing data to disk.
|
* before writing data to disk.
|
||||||
*/
|
*/
|
||||||
if (strcmp(buf, archive_entry_pathname(entry)) == 0) {
|
if (strcmp(prepost, archive_entry_pathname(entry)) == 0) {
|
||||||
actgt = true;
|
actgt = true;
|
||||||
|
|
||||||
|
archive_entry_set_pathname(entry, buf);
|
||||||
|
|
||||||
if ((rv = archive_read_extract(ar, entry, flags)) != 0)
|
if ((rv = archive_read_extract(ar, entry, flags)) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((rv = xbps_file_exec(buf, "preinst")) != 0) {
|
if ((rv = xbps_file_exec(buf, pkgname,
|
||||||
|
"preinst", NULL)) != 0) {
|
||||||
printf("%s: preinst action target error %s\n",
|
printf("%s: preinst action target error %s\n",
|
||||||
pkgname, strerror(errno));
|
pkgname, strerror(errno));
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
|
@ -327,7 +331,8 @@ xbps_unpack_archive_cb(struct archive *ar, const char *pkgname)
|
||||||
* Run the post installaction action target, if package
|
* Run the post installaction action target, if package
|
||||||
* contains the script.
|
* contains the script.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_file_exec(buf, "postinst")) != 0) {
|
if ((rv = xbps_file_exec(buf, pkgname,
|
||||||
|
"postinst", NULL)) != 0) {
|
||||||
printf("%s: postinst action target error %s\n",
|
printf("%s: postinst action target error %s\n",
|
||||||
pkgname, strerror(errno));
|
pkgname, strerror(errno));
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
|
|
|
@ -120,6 +120,12 @@ _EOF
|
||||||
cp -f $TMPFPROPS $metadir/props.plist
|
cp -f $TMPFPROPS $metadir/props.plist
|
||||||
chmod 644 $metadir/*
|
chmod 644 $metadir/*
|
||||||
rm -f $TMPFLIST $TMPFPROPS
|
rm -f $TMPFLIST $TMPFPROPS
|
||||||
|
|
||||||
|
if [ -f "$XBPS_TEMPLATESDIR/$pkgname.prepost-action" ]; then
|
||||||
|
cp -f $XBPS_TEMPLATESDIR/$pkgname.prepost-action \
|
||||||
|
$destdir/XBPS_PREPOST_ACTION
|
||||||
|
chmod +x $destdir/XBPS_PREPOST_ACTION
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -133,11 +139,7 @@ xbps_make_binpkg()
|
||||||
|
|
||||||
cd $destdir || exit 1
|
cd $destdir || exit 1
|
||||||
|
|
||||||
#
|
run_rootcmd tar cfjp $XBPS_DESTDIR/$binpkg .
|
||||||
# Sort the tar archive to have a chance that metadata is at
|
|
||||||
# the beginning.
|
|
||||||
#
|
|
||||||
run_rootcmd tar cfjp $XBPS_DESTDIR/$binpkg . | sort -r
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
[ ! -d $XBPS_PACKAGESDIR ] && mkdir -p $XBPS_PACKAGESDIR
|
[ ! -d $XBPS_PACKAGESDIR ] && mkdir -p $XBPS_PACKAGESDIR
|
||||||
mv -f $XBPS_DESTDIR/$binpkg $XBPS_PACKAGESDIR
|
mv -f $XBPS_DESTDIR/$binpkg $XBPS_PACKAGESDIR
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue