Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
backup: remove the backup command which was confusing
Baptiste Daroussin committed 3 years ago
commit eea1a990eb1187a408811534a5060e58074a9044
parent aa683bf
50 files changed +2 -317
modified README.md
@@ -35,7 +35,6 @@ Table of Contents:
* [Updating remote repositories](#pkgupdate)
* [Searching in remote package repositories](#pkgsearch)
* [Installing from remote repositories](#pkginstall)
-
* [Backing up your package database](#pkgbackup)
* [Creating a package repository](#pkgcreate)
* [Additional resources](#resources)

@@ -477,21 +476,6 @@ Or you could also install the packages using only one command, like this:
For more information on the remote package installs, please refer to
*pkg-install(1)*

-
<a name="pkgbackup"></a>
-
### Backing up your package database
-

-
It is a good idea that you backup your local package database on regular basis.
-

-
In order to backup the local package database, you should use the `pkg backup` command.
-

-
	# pkg backup -d /path/to/pkg-backup.dump
-

-
The above command will create a dump of your local package database in
-
/path/to/pkg-backup.dump
-

-
For more information on backing up your local package database, please
-
refer to *pkg-backup(1)*
-

<a name="pkgcreate"></a>
### Creating a package repository

modified docs/Makefile.autosetup
@@ -14,7 +14,6 @@ MAN8= pkg-add.8 \
	pkg-annotate.8 \
	pkg-audit.8 \
	pkg-autoremove.8 \
-
	pkg-backup.8 \
	pkg-check.8 \
	pkg-clean.8 \
	pkg-config.8 \
modified docs/pkg-add.8
@@ -129,7 +129,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-alias.8
@@ -75,7 +75,6 @@ for alias
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-annotate.8
@@ -195,7 +195,6 @@ Show all packages with the foo annotation:
.Xr pkg-alias 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-audit.8
@@ -129,7 +129,6 @@ See
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-autoremove.8
@@ -75,7 +75,6 @@ See
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
deleted docs/pkg-backup.8
@@ -1,108 +0,0 @@
-
.\"
-
.\" FreeBSD pkg - a next generation package for the installation and maintenance
-
.\" of non-core utilities.
-
.\"
-
.\" Redistribution and use in source and binary forms, with or without
-
.\" modification, are permitted provided that the following conditions
-
.\" are met:
-
.\" 1. Redistributions of source code must retain the above copyright
-
.\"    notice, this list of conditions and the following disclaimer.
-
.\" 2. Redistributions in binary form must reproduce the above copyright
-
.\"    notice, this list of conditions and the following disclaimer in the
-
.\"    documentation and/or other materials provided with the distribution.
-
.\"
-
.\"
-
.\"     @(#)pkg.8
-
.\"
-
.Dd May 12, 2015
-
.Dt PKG-BACKUP 8
-
.Os
-
.Sh NAME
-
.Nm "pkg backup"
-
.Nd backup and restore the local package database
-
.Sh SYNOPSIS
-
.Nm
-
.Op Fl q
-
.Fl d Ar dest_file
-
.Nm
-
.Op Fl q
-
.Fl r Ar src_file
-
.Pp
-
.Nm
-
.Op Cm --quiet
-
.Cm --dump Ar dest_file
-
.Nm
-
.Op Cm --quiet
-
.Cm --restore Ar src_file
-
.Sh DESCRIPTION
-
.Nm
-
is used to backup and restore the local package database.
-
.Sh OPTIONS
-
The following options are supported by
-
.Nm :
-
.Bl -tag -width restore
-
.It Fl d Ar dest_file , Cm --dump Ar dest_file
-
Dumps the local package database to a file specified on the
-
command-line.
-
.It Fl q , Cm --quiet
-
Force quiet output.
-
.It Fl r Ar src_file , Cm --restore Ar src_file
-
Uses
-
.Ar src_file
-
in order to restore the local package database.
-
Useful in case of a database crash or loss, to restore your database
-
from a previous backup.
-
.El
-
.Sh ENVIRONMENT
-
The following environment variables affect the execution of
-
.Nm .
-
See
-
.Xr pkg.conf 5
-
for further description.
-
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
-
.It Ev PKG_DBDIR
-
.El
-
.Sh FILES
-
See
-
.Xr pkg.conf 5 .
-
.Sh SEE ALSO
-
.Xr pkg_create 3 ,
-
.Xr pkg_printf 3 ,
-
.Xr pkg_repos 3 ,
-
.Xr pkg-keywords 5 ,
-
.Xr pkg-lua-script 5 ,
-
.Xr pkg-repository 5 ,
-
.Xr pkg-script 5 ,
-
.Xr pkg-triggers 5 ,
-
.Xr pkg.conf 5 ,
-
.Xr pkg 8 ,
-
.Xr pkg-add 8 ,
-
.Xr pkg-alias 8 ,
-
.Xr pkg-annotate 8 ,
-
.Xr pkg-audit 8 ,
-
.Xr pkg-autoremove 8 ,
-
.Xr pkg-check 8 ,
-
.Xr pkg-clean 8 ,
-
.Xr pkg-config 8 ,
-
.Xr pkg-create 8 ,
-
.Xr pkg-delete 8 ,
-
.Xr pkg-fetch 8 ,
-
.Xr pkg-info 8 ,
-
.Xr pkg-install 8 ,
-
.Xr pkg-lock 8 ,
-
.Xr pkg-query 8 ,
-
.Xr pkg-register 8 ,
-
.Xr pkg-repo 8 ,
-
.Xr pkg-rquery 8 ,
-
.Xr pkg-search 8 ,
-
.Xr pkg-set 8 ,
-
.Xr pkg-shell 8 ,
-
.Xr pkg-shlib 8 ,
-
.Xr pkg-ssh 8 ,
-
.Xr pkg-stats 8 ,
-
.Xr pkg-triggers 8 ,
-
.Xr pkg-update 8 ,
-
.Xr pkg-updating 8 ,
-
.Xr pkg-upgrade 8 ,
-
.Xr pkg-version 8 ,
-
.Xr pkg-which 8
modified docs/pkg-check.8
@@ -174,7 +174,6 @@ pkg check -sa
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
modified docs/pkg-clean.8
@@ -88,7 +88,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
modified docs/pkg-config.8
@@ -53,7 +53,6 @@ Getting the directories where the repositories configuration are read:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-create 8 ,
modified docs/pkg-create.8
@@ -489,7 +489,6 @@ Create package file for pkg:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-delete.8
@@ -157,7 +157,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-fetch.8
@@ -157,7 +157,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-info.8
@@ -191,7 +191,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-install.8
@@ -215,7 +215,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-keywords.5
@@ -167,7 +167,6 @@ being in the example case,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-lock.8
@@ -159,7 +159,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-lua-script.5
@@ -164,7 +164,6 @@ are be filtered out.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-query.8
@@ -406,7 +406,6 @@ List unmaintained packages:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-register.8
@@ -196,7 +196,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-repo.8
@@ -220,7 +220,6 @@ filename.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-repository.5
@@ -305,7 +305,6 @@ in
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-rquery.8
@@ -353,7 +353,6 @@ for example usage.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-script.5
@@ -82,7 +82,6 @@ Variable existing when the scripts is run in the context of an upgrade of the pa
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-search.8
@@ -478,7 +478,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-set.8
@@ -157,7 +157,6 @@ for further description.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-shell.8
@@ -65,7 +65,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-shlib.8
@@ -84,7 +84,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-ssh.8
@@ -63,7 +63,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-stats.8
@@ -68,7 +68,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-triggers.5
@@ -91,7 +91,6 @@ the transaction.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-triggers.8
@@ -56,7 +56,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-update.8
@@ -113,7 +113,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-updating.8
@@ -101,7 +101,6 @@ installed ports:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-upgrade.8
@@ -218,7 +218,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-version.8
@@ -306,7 +306,6 @@ The following command compares two package version strings:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg-which.8
@@ -78,7 +78,6 @@ See
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg.8
@@ -209,8 +209,6 @@ List the command line aliases.
Audit installed packages against known vulnerabilities.
.It Ic autoremove
Delete packages which were automatically installed as dependencies and are not required any more.
-
.It Ic backup
-
Dump the local package database to a file specified on the command-line.
.It Ic bootstrap
This is for compatibility with the
.Xr pkg 7
@@ -387,7 +385,6 @@ Restore a backup database:
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg.conf.5
@@ -656,7 +656,6 @@ ignored), and reads the configuration files instead.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified docs/pkg_printf.3
@@ -923,7 +923,6 @@ Insufficient storage space is available.
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
-
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
modified libpkg/Makefile.autosetup
@@ -1,7 +1,6 @@
include @builddir@/mk/defs.mk
LIB=	pkg
-
SRCS=	backup.c \
-
	backup_lib.c \
+
SRCS=	backup_lib.c \
	merge3.c \
	pkg_audit.c \
	pkg_deps.c \
modified libpkg/libpkg.ver
@@ -178,12 +178,10 @@ global:
	pkgdb_compact;
	pkgdb_delete_annotation;
	pkgdb_downgrade_lock;
-
	pkgdb_dump;
	pkgdb_it_count;
	pkgdb_it_free;
	pkgdb_it_next;
	pkgdb_it_reset;
-
	pkgdb_load;
	pkgdb_modify_annotation;
	pkgdb_obtain_lock;
	pkgdb_open;
modified libpkg/pkg.h.in
@@ -931,15 +931,6 @@ void pkgdb_close(struct pkgdb *db);
int pkgdb_remote_init(struct pkgdb *db, const char *reponame);

/**
-
 * Dump to or load from a backup copy of the main database file
-
 * (local.sqlite)
-
 */
-

-
int pkgdb_dump(struct pkgdb *db, const char *dest);
-
int pkgdb_load(struct pkgdb *db, const char *src);
-

-

-
/**
 * Set the case sensitivity flag on or off.  Defaults to
 * true (case_sensitive)
 */
modified scripts/completion/_pkg.bash.in
@@ -93,18 +93,6 @@ _pkgng_autoremove () {
    large_info=""
}

-
_pkgng_backup () {
-
    local cur prev opts lopts
-
    COMPREPLY=()
-

-
    opts=('-r' '-d')
-
    lopts=('-r[Restore the local package database]' 
-
           '-d[Dumps the local package database]')
-

-
    small_info="Backs-up and restores the local package database"
-
    large_info=""
-
}
-

_pkgng_check () {
    local cur prev opts lopts
    COMPREPLY=()
@@ -373,7 +361,7 @@ _pkg () {
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    
    # init opts for first completion
-
    opts='add audit autoremove backup check clean create delete
+
    opts='add audit autoremove check clean create delete
          fetch help info install query rquery search set shell
          shlib stats update updating upgrade version which'

@@ -381,7 +369,6 @@ _pkg () {
    lopts=( 'add[Registers a package and installs it on the system]'
            'audit[Reports vulnerable packages]'
            'autoremove[Removes orphan packages]'
-
            'backup[Backs-up and restores the local package database]'
            'check[Checks for missing dependencies and database consistency]'
            'clean[Cleans old packages from the cache]'
            'convert[Convert database from/to pkgng]'
@@ -428,14 +415,6 @@ _pkg () {
	    COMPREPLY=( $(compgen) ) && \
		return 0 ;;

-
        backup) 
-
	    COMPREPLY=(
-
		'(-r)-d[Dumps the local package database]'
-
		'(-d)-r[Restore the local package database]'
-
	    )
-
	    return 0 
-
	    ;;
-

        check) 
	    COMPREPLY=(
		'-B[reanalyse the shared libraries]' 
modified scripts/completion/_pkg.in
@@ -48,7 +48,6 @@ _pkg_subcommands() {
		'annotate:add, modify or delete tag-value style annotations on packages'
		'audit:report vulnerable packages'
		'autoremove:remove orphaned packages'
-
		'backup:back-up and restore the local package database'
		'check:check for missing dependencies and database consistency'
		'clean:clean old packages from the cache'
		'config:display value of a configuration option'
@@ -248,13 +247,6 @@ _pkg_args() {
				'(-y --yes -n --dry-run)'{-n,--dry-run}'[assume no (dry run) when asked for confirmation]'
			return
			;;
-
		(backup)
-
			_arguments -s \
-
				'(-q --quiet)'{-q,--quiet}'[force quiet output]' \
-
				'(-d --dump -r --restore)'{-d+,--dump=}'[dump the local package database]:destination:_files' \
-
				'(-d --dump -r --restore)'{-r+,--restore=}'[restore the local package database]:destination:_files'
-
			return
-
			;;
		(check)
			_arguments -A '-*' -s \
				'(-B --shlibs)'{-B,--shlibs}'[reanalyze the shared libraries]' \
modified src/Makefile.autosetup
@@ -5,7 +5,6 @@ SRCS= add.c \
	annotate.c \
	audit.c \
	autoremove.c \
-
	backup.c \
	check.c \
	clean.c \
	config.c \
deleted src/backup.c
@@ -1,103 +0,0 @@
-
/*-
-
 * Copyright (c) 2011-2012 Baptiste Daroussin <bapt@FreeBSD.org>
-
 * Copyright (c) 2011-2012 Marin Atanasov Nikolov <dnaeon@gmail.com>
-
 * Copyright (c) 2014 Matthew Seaman <matthew@FreeBSD.org>
-
 * All rights reserved.
-
 * 
-
 * Redistribution and use in source and binary forms, with or without
-
 * modification, are permitted provided that the following conditions
-
 * are met:
-
 * 1. Redistributions of source code must retain the above copyright
-
 *    notice, this list of conditions and the following disclaimer
-
 *    in this position and unchanged.
-
 * 2. Redistributions in binary form must reproduce the above copyright
-
 *    notice, this list of conditions and the following disclaimer in the
-
 *    documentation and/or other materials provided with the distribution.
-
 * 
-
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
-
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
-
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 */
-

-
#include <pkg.h>
-
#include <getopt.h>
-
#include <unistd.h>
-

-
#include "pkgcli.h"
-

-
void
-
usage_backup(void)
-
{
-
	fprintf(stderr, "Usage: pkg backup [-q] -d <dest_file>\n");
-
	fprintf(stderr, "       pkg backup [-q] -r <src_file>\n\n");
-
	fprintf(stderr, "For more information see 'pkg help backup'.\n");
-
}
-

-
int
-
exec_backup(int argc, char **argv)
-
{
-
	struct pkgdb	*db = NULL;
-
	char		*backup_file = NULL;
-
	bool		 dump = false;
-
	bool		 restore = false;
-
	int		 ch;
-

-
	struct option longopts[] = {
-
		{ "dump",	required_argument,	NULL,	'd' },
-
		{ "quiet",	no_argument,		NULL,	'q' },
-
		{ "restore",	required_argument,	NULL,	'r' },
-
		{ NULL,		0,			NULL,	0   },
-
	};
-

-
	while ((ch = getopt_long(argc, argv, "+d:qr:", longopts, NULL)) != -1) {
-
		switch (ch) {
-
		case 'd':
-
			dump = true;
-
			backup_file = optarg;
-
			break;
-
		case 'q':
-
			quiet = true;
-
			break;
-
		case 'r':
-
			restore = true;
-
			backup_file = optarg;
-
			break;
-
		default:
-
			usage_backup();
-
			return (EXIT_FAILURE);
-
		}
-
	}
-

-
	if ( dump == restore ) {
-
		usage_backup();
-
		return (EXIT_FAILURE);
-
	}
-

-
	if (pkgdb_open(&db, PKGDB_DEFAULT) != EPKG_OK)
-
		return (EXIT_FAILURE);
-

-
	if (dump) {
-
		if (!quiet)
-
			printf("Dumping database:\n");
-
		if (pkgdb_dump(db, backup_file) == EPKG_FATAL)
-
			return (EXIT_FAILURE);
-
	}
-

-
	if (restore) {
-
		if (!quiet)
-
			printf("Restoring database:\n");
-
		if (pkgdb_load(db, backup_file) == EPKG_FATAL)
-
			return (EXIT_FAILURE);
-
	}
-

-
	pkgdb_close(db);
-

-
	return (EXIT_SUCCESS);
-
}
modified src/main.c
@@ -89,7 +89,6 @@ static struct commands {
	{ "annotate", "Add, modify or delete tag-value style annotations on packages", exec_annotate, usage_annotate},
	{ "audit", "Reports vulnerable packages", exec_audit, usage_audit},
	{ "autoremove", "Removes orphan packages", exec_autoremove, usage_autoremove},
-
	{ "backup", "Backs-up and restores the local package database", exec_backup, usage_backup},
	{ "check", "Checks for missing dependencies and database consistency", exec_check, usage_check},
	{ "clean", "Cleans old packages from the cache", exec_clean, usage_clean},
	{ "config", "Display the value of the configuration options", exec_config, usage_config},
modified src/pkgcli.h
@@ -64,10 +64,6 @@ void usage_audit(void);
int exec_autoremove(int, char **);
void usage_autoremove(void);

-
/* pkg backup */
-
int exec_backup(int, char **);
-
void usage_backup(void);
-

/* pkg check */
int exec_check(int, char **);
void usage_check(void);