pkg: remove support for the deprecated .INSTALL script
parent
623bc9c5a8
commit
6715a0ba12
|
@ -20,7 +20,6 @@ struct apk_database;
|
||||||
struct apk_name;
|
struct apk_name;
|
||||||
|
|
||||||
#define APK_SCRIPT_INVALID -1
|
#define APK_SCRIPT_INVALID -1
|
||||||
#define APK_SCRIPT_GENERIC 0
|
|
||||||
#define APK_SCRIPT_PRE_INSTALL 1
|
#define APK_SCRIPT_PRE_INSTALL 1
|
||||||
#define APK_SCRIPT_POST_INSTALL 2
|
#define APK_SCRIPT_POST_INSTALL 2
|
||||||
#define APK_SCRIPT_PRE_DEINSTALL 3
|
#define APK_SCRIPT_PRE_DEINSTALL 3
|
||||||
|
|
|
@ -1179,11 +1179,7 @@ static int apk_db_install_archive_entry(void *_ctx,
|
||||||
/* Package metainfo and script processing */
|
/* Package metainfo and script processing */
|
||||||
if (ae->name[0] == '.') {
|
if (ae->name[0] == '.') {
|
||||||
/* APK 2.0 format */
|
/* APK 2.0 format */
|
||||||
if (strcmp(ae->name, ".INSTALL") == 0)
|
|
||||||
type = APK_SCRIPT_GENERIC;
|
|
||||||
else
|
|
||||||
type = apk_script_type(&ae->name[1]);
|
type = apk_script_type(&ae->name[1]);
|
||||||
|
|
||||||
if (type == APK_SCRIPT_INVALID)
|
if (type == APK_SCRIPT_INVALID)
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(ae->name, "var/db/apk/", 11) == 0) {
|
} else if (strncmp(ae->name, "var/db/apk/", 11) == 0) {
|
||||||
|
@ -1205,8 +1201,7 @@ static int apk_db_install_archive_entry(void *_ctx,
|
||||||
if (type != APK_SCRIPT_INVALID) {
|
if (type != APK_SCRIPT_INVALID) {
|
||||||
apk_pkg_add_script(pkg, is, type, ae->size);
|
apk_pkg_add_script(pkg, is, type, ae->size);
|
||||||
|
|
||||||
if (type == APK_SCRIPT_GENERIC ||
|
if (type == ctx->script) {
|
||||||
type == ctx->script) {
|
|
||||||
r = apk_pkg_run_script(pkg, db->root_fd, ctx->script);
|
r = apk_pkg_run_script(pkg, db->root_fd, ctx->script);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
apk_error("%s-%s: Failed to execute pre-install/upgrade script",
|
apk_error("%s-%s: Failed to execute pre-install/upgrade script",
|
||||||
|
|
|
@ -242,15 +242,6 @@ const char *apk_script_types[] = {
|
||||||
[APK_SCRIPT_POST_UPGRADE] = "post-upgrade",
|
[APK_SCRIPT_POST_UPGRADE] = "post-upgrade",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *script_types2[] = {
|
|
||||||
[APK_SCRIPT_PRE_INSTALL] = "pre_install",
|
|
||||||
[APK_SCRIPT_POST_INSTALL] = "post_install",
|
|
||||||
[APK_SCRIPT_PRE_DEINSTALL] = "pre_deinstall",
|
|
||||||
[APK_SCRIPT_POST_DEINSTALL] = "post_deinstall",
|
|
||||||
[APK_SCRIPT_PRE_UPGRADE] = "pre_upgrade",
|
|
||||||
[APK_SCRIPT_POST_UPGRADE] = "post_upgrade",
|
|
||||||
};
|
|
||||||
|
|
||||||
int apk_script_type(const char *name)
|
int apk_script_type(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -569,8 +560,7 @@ int apk_pkg_run_script(struct apk_package *pkg, int root_fd,
|
||||||
|
|
||||||
fchdir(root_fd);
|
fchdir(root_fd);
|
||||||
hlist_for_each_entry(script, c, &pkg->scripts, script_list) {
|
hlist_for_each_entry(script, c, &pkg->scripts, script_list) {
|
||||||
if (script->type != type &&
|
if (script->type != type)
|
||||||
script->type != APK_SCRIPT_GENERIC)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snprintf(fn, sizeof(fn),
|
snprintf(fn, sizeof(fn),
|
||||||
|
@ -591,9 +581,6 @@ int apk_pkg_run_script(struct apk_package *pkg, int root_fd,
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
if (chroot(".") < 0) {
|
if (chroot(".") < 0) {
|
||||||
apk_error("chroot: %s", strerror(errno));
|
apk_error("chroot: %s", strerror(errno));
|
||||||
} else if (script->type == APK_SCRIPT_GENERIC) {
|
|
||||||
execle(fn, "INSTALL", script_types2[type],
|
|
||||||
pkg->version, "", NULL, environment);
|
|
||||||
} else {
|
} else {
|
||||||
execle(fn, apk_script_types[type],
|
execle(fn, apk_script_types[type],
|
||||||
pkg->version, "", NULL, environment);
|
pkg->version, "", NULL, environment);
|
||||||
|
|
Loading…
Reference in New Issue