tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkgdb



> @@ -303,8 +300,21 @@ pkgdb_refcount_dir(void)
>  const char *
>  pkgdb_get_dir(void)
>  {
> +	/* Except for the return at this end, this code is for
> +	   migration from the previous location /var/db/pkg to the new
> +	   default (December 2020). */
> +
> +	struct stat sb;
> +	if (strcmp(pkgdb_dir, DEF_LOG_DIR) == 0 &&
> +	    stat(pkgdb_dir, &sb) == -1 && errno == ENOENT &&
> +	    stat("/var/db/pkg", &sb) == 0) {
> +		errx(EXIT_FAILURE,
> +		     "The default PKG_DBDIR has changed, but this installation still uses the old one.\n"
> +		     "Please move the database and re-run this command:\n"
> +		     "\tmv /var/db/pkg " DEF_LOG_DIR);
> +	}
>  
> -	return pkgdb_dir;
> +        return pkgdb_dir;
>  }
>  
>  /*
> 

Main interest to move pkgdb_dir away from /var/db/pkg was that other
package managers deposit files there, too. Erroring is only safe on
NetBSD.

This is also a great place to add backwards-compatibility.


Home | Main Index | Thread Index | Old Index