summaryrefslogtreecommitdiff
path: root/src/update-package.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/update-package.c')
-rw-r--r--src/update-package.c78
1 files changed, 46 insertions, 32 deletions
diff --git a/src/update-package.c b/src/update-package.c
index d11a97c..b5ce23f 100644
--- a/src/update-package.c
+++ b/src/update-package.c
@@ -78,7 +78,7 @@ char *root = NULL, *pkgs_path = NULL, *rempkgs_path = NULL, *remlog_fname = NULL
*pkg_fname = NULL, *asc_fname = NULL, *pkglog_fname = NULL, *pkglist_fname = NULL,
*tmpdir = NULL, *rtmpdir = NULL, *curdir = NULL, *log_fname = NULL;
-int ask = 0, rqck = 0, gpgck = 0, reinstall = 0, ignore_chrefs_errors = 0;
+int ask = 0, rqck = 0, gpgck = 0, reinstall = 0, ignore_chrefs_errors = 0, disable_chrefs = 0;
char *description = NULL;
int exit_status = EXIT_SUCCESS; /* errors counter */
@@ -211,6 +211,7 @@ void usage()
fprintf( stdout, " and located in the same directory as the package.\n" );
#endif
fprintf( stdout, " --ignore-chrefs-errors Ignore change references errors (code: 48).\n" );
+ fprintf( stdout, " --disable-chrefs Do not manage references to the package.\n" );
#if defined( HAVE_DIALOG )
fprintf( stdout, " -i,--info-dialog Show package description during update\n" );
fprintf( stdout, " process using ncurses dialog.\n" );
@@ -700,6 +701,7 @@ void get_args( int argc, char *argv[] )
#define REINSTALL 812
#define IGNORE_CHREFS_ERRORS 872
+#define DISABLE_CHREFS 873
const struct option long_options[] =
{
@@ -711,6 +713,7 @@ void get_args( int argc, char *argv[] )
{ "gpg-verify", no_argument, NULL, 'g' },
#endif
{ "ignore-chrefs-errors", no_argument, NULL, IGNORE_CHREFS_ERRORS },
+ { "disable-chrefs", no_argument, NULL, DISABLE_CHREFS },
#if defined( HAVE_DIALOG )
{ "info-dialog", no_argument, NULL, 'i' },
{ "menu-dialog", no_argument, NULL, 'm' },
@@ -780,6 +783,11 @@ void get_args( int argc, char *argv[] )
ignore_chrefs_errors = 1;
break;
}
+ case DISABLE_CHREFS:
+ {
+ disable_chrefs = 1;
+ break;
+ }
case 'p':
{
@@ -2446,44 +2454,47 @@ static void finalize_removal( void )
/*********************************************
Decrement references in the Setup Database:
*/
- if( installed_group )
- len = snprintf( &cmd[0], PATH_MAX,
- "%s/chrefs --operation=dec --destination=%s %s/%s > /dev/null 2>&1",
- selfdir, pkgs_path, installed_group, basename( (char *)remlog_fname ) );
- else
- len = snprintf( &cmd[0], PATH_MAX,
- "%s/chrefs --operation=dec --destination=%s %s > /dev/null 2>&1",
- selfdir, pkgs_path, basename( (char *)remlog_fname ) );
- if( len == 0 || len == PATH_MAX - 1 )
+ if( !disable_chrefs )
{
- FATAL_ERROR( "Cannot decrement '%s-%s' package references", pkgname, pkgver );
- }
- p = sys_exec_command( cmd );
- rc = sys_wait_command( p, (char *)NULL, PATH_MAX );
- if( (rc != 0) && !ignore_chrefs_errors )
- {
- free( cmd );
- free( tmp );
+ if( installed_group )
+ len = snprintf( &cmd[0], PATH_MAX,
+ "%s/chrefs --operation=dec --destination=%s %s/%s > /dev/null 2>&1",
+ selfdir, pkgs_path, installed_group, basename( (char *)remlog_fname ) );
+ else
+ len = snprintf( &cmd[0], PATH_MAX,
+ "%s/chrefs --operation=dec --destination=%s %s > /dev/null 2>&1",
+ selfdir, pkgs_path, basename( (char *)remlog_fname ) );
+ if( len == 0 || len == PATH_MAX - 1 )
+ {
+ FATAL_ERROR( "Cannot decrement '%s-%s' package references", pkgname, pkgver );
+ }
+ p = sys_exec_command( cmd );
+ rc = sys_wait_command( p, (char *)NULL, PATH_MAX );
+ if( (rc != 0) && !ignore_chrefs_errors )
+ {
+ free( cmd );
+ free( tmp );
- exit_status = 48;
+ exit_status = 48;
- if( update_mode != CONSOLE )
- {
+ if( update_mode != CONSOLE )
+ {
#if defined( HAVE_DIALOG )
- info_pkg_box( "Update:", pkgname, pkgver, NULL,
- "\n\\Z1Cannot decrement package references in Setup Database.\\Zn\n", 5, 0, 0 );
+ info_pkg_box( "Update:", pkgname, pkgver, NULL,
+ "\n\\Z1Cannot decrement package references in Setup Database.\\Zn\n", 5, 0, 0 );
#else
- fprintf( stdout, "\nCannot decrement '%s-%s' package references in Setup Database.\n\n", pkgname, pkgver );
+ fprintf( stdout, "\nCannot decrement '%s-%s' package references in Setup Database.\n\n", pkgname, pkgver );
#endif
- }
- else
- {
- fprintf( stdout, "\nCannot decrement '%s-%s' package references in Setup Database.\n\n", pkgname, pkgver );
- }
+ }
+ else
+ {
+ fprintf( stdout, "\nCannot decrement '%s-%s' package references in Setup Database.\n\n", pkgname, pkgver );
+ }
- if( tmpdir ) { _rm_tmpdir( (const char *)tmpdir ); free( tmpdir ); }
- free_resources();
- exit( exit_status );
+ if( tmpdir ) { _rm_tmpdir( (const char *)tmpdir ); free( tmpdir ); }
+ free_resources();
+ exit( exit_status );
+ }
}
/*****************************************************
@@ -3074,6 +3085,8 @@ static void finalize_update( void )
/*********************************************
Increment references in the Setup Database:
*/
+if( !disable_chrefs )
+{
if( group )
len = snprintf( &cmd[0], PATH_MAX,
"%s/chrefs --operation=inc --destination=%s %s/%s > /dev/null 2>&1",
@@ -3117,6 +3130,7 @@ static void finalize_update( void )
free_resources();
exit( exit_status );
}
+}
/*************************************************
Remove backup PKGLOG file from removed-packages