xbps-bin(8): if -f is set, remove files and configuration files even
if its hash doesn't match for the remove and purge targets respectively. --HG-- extra : convert_revision : xtraeme%40gmail.com-20100125070948-841kw2r4knz2793e
This commit is contained in:
		
							
								
								
									
										4
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								NEWS
									
									
									
									
									
								
							@@ -1,4 +1,8 @@
 | 
			
		||||
xbps-0.4 (2010-02-01):
 | 
			
		||||
 
 | 
			
		||||
 * xbps-bin(8): enable -f option for the 'purge' and 'remove' targets.
 | 
			
		||||
   If set, files will be removed even if its hash doesn't match for the
 | 
			
		||||
   'remove' target, and configuration files for the 'purge' target.
 | 
			
		||||
 | 
			
		||||
 * xbps-uhelper: the 'fetch' target now accepts an arbitrary number of
 | 
			
		||||
   arguments, and sets default libfetch cache connection limits.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2008-2009 Juan Romero Pardines.
 | 
			
		||||
 * Copyright (c) 2008-2010 Juan Romero Pardines.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -61,8 +61,8 @@ usage(void)
 | 
			
		||||
	"    -V\t\tPrints the xbps release version\n"
 | 
			
		||||
	" Options used by the install/(auto)remove/update targets:\n"
 | 
			
		||||
	"    -y\t\tAssume \"yes\" for all questions.\n"
 | 
			
		||||
	" Options used by the reconfigure target:\n"
 | 
			
		||||
	"    -f\t\tForce reconfiguration.\n"
 | 
			
		||||
	" Options used by the purge/reconfigure/remove targets:\n"
 | 
			
		||||
	"    -f\t\tForce reconfiguration or removal of files.\n"
 | 
			
		||||
	"\n");
 | 
			
		||||
	exit(EXIT_FAILURE);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,10 @@ OPTIONS
 | 
			
		||||
	it will become '/blah/cachedir'.
 | 
			
		||||
 | 
			
		||||
*-f*::
 | 
			
		||||
	Used currently in the 'reconfigure' target. If set, package(s) will
 | 
			
		||||
	be reconfigured regardless of its state.
 | 
			
		||||
	Used currently in the 'purge', 'reconfigure' and 'remove' targets.
 | 
			
		||||
	If set, package(s) will be reconfigured regardless of its state if working
 | 
			
		||||
	with the 'reconfigure target, or to force removal of package files
 | 
			
		||||
	even if its hash doesn't match in the 'purge' and 'remove' targets.
 | 
			
		||||
 | 
			
		||||
*-r* 'rootdir'::
 | 
			
		||||
	Sets the 'root' directory. By default the root directory is
 | 
			
		||||
@@ -96,7 +98,8 @@ Please note that all targets are *case insensitive*.
 | 
			
		||||
	metadata directory ( /var/db/xbps/metadata/'pkgname' ) and will
 | 
			
		||||
	remove configuration (if they were not modified by the user) and
 | 
			
		||||
	metadata files. The package will be fully removed from the system once
 | 
			
		||||
	it has been *purged*.
 | 
			
		||||
	it has been *purged*. If *-f* option is used, configuration files
 | 
			
		||||
	that have been modified *WILL BE REMOVED, BEWARE WITH THIS!*.
 | 
			
		||||
 | 
			
		||||
*reconfigure 'pkgname' | 'all'*::
 | 
			
		||||
	Reconfigure an *unpacked* package. Packages in this state are not
 | 
			
		||||
@@ -113,7 +116,8 @@ Please note that all targets are *case insensitive*.
 | 
			
		||||
	database. Configuration files, its metadata directory/files and
 | 
			
		||||
	its information in the package database are preserved. To fully remove
 | 
			
		||||
	a package in *config-files* state, it must be *purged* with the
 | 
			
		||||
	*purge* command.
 | 
			
		||||
	*purge* command. If *-f* option is used, package files will be removed
 | 
			
		||||
	even if its SHA256 hash doesn't match.
 | 
			
		||||
 | 
			
		||||
*show 'pkgname'*::
 | 
			
		||||
	Shows information for installed package 'pkgname'. This will print
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								lib/remove.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								lib/remove.c
									
									
									
									
									
								
							@@ -42,7 +42,8 @@
 | 
			
		||||
 *  -# Its <b>pre-remove</b> target specified in the REMOVE script
 | 
			
		||||
 *     will be executed.
 | 
			
		||||
 *  -# Its files, dirs and links will be removed. Modified files (not
 | 
			
		||||
 *     matching its sha256 hash) will always be preserved.
 | 
			
		||||
 *     matching its sha256 hash) are preserved, unless XBPS_FLAG_FORCE
 | 
			
		||||
 *     is set via xbps_set_flags().
 | 
			
		||||
 *  -# Its <b>post-remove</b> target specified in the REMOVE script
 | 
			
		||||
 *     will be executed.
 | 
			
		||||
 *  -# Its requiredby objects will be removed from the installed packages
 | 
			
		||||
@@ -123,13 +124,24 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
 | 
			
		||||
				rv = 0;
 | 
			
		||||
				continue;
 | 
			
		||||
			} else if (rv == ERANGE) {
 | 
			
		||||
				if (flags & XBPS_FLAG_VERBOSE)
 | 
			
		||||
					fprintf(stderr,
 | 
			
		||||
					    "WARNING: '%s' SHA256 mismatch, "
 | 
			
		||||
				    	    "preserving...\n", file);
 | 
			
		||||
				rv = 0;
 | 
			
		||||
				free(path);
 | 
			
		||||
				continue;
 | 
			
		||||
				if (flags & XBPS_FLAG_VERBOSE) {
 | 
			
		||||
					if (flags & XBPS_FLAG_FORCE) {
 | 
			
		||||
						fprintf(stderr,
 | 
			
		||||
						    "WARNING: '%s' SHA256 "
 | 
			
		||||
						    "mismatch, forcing "
 | 
			
		||||
						    "removal...\n", file);
 | 
			
		||||
					} else {
 | 
			
		||||
						fprintf(stderr,
 | 
			
		||||
					    	"WARNING: '%s' SHA256 "
 | 
			
		||||
						"mismatch, preserving...\n",
 | 
			
		||||
						file);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if ((flags & XBPS_FLAG_FORCE) == 0) {
 | 
			
		||||
					free(path);
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
			} else if (rv != 0 && rv != ERANGE) {
 | 
			
		||||
				free(path);
 | 
			
		||||
				break;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user