Skip to content

Commit

Permalink
Update package directory structure for slack 15.0
Browse files Browse the repository at this point in the history
In Slackware 15.0, the package info installation directories have
changed. Almost everything moved out of /var/log, so /var/log can be
volatile, as it should have always been.

List of changes is:
* /var/log/packages -> /var/lib/pkgtools/packages
* /var/log/scripts  -> /var/lib/pkgtools/scripts
* /var/log/setup    -> /var/lib/pkgtools/setup
* /var/log/removed_packages -> /var/log/pkgtools/removed_packages
* /var/log/removed_scripts  -> /var/log/pkgtools/removed_scripts

There's also a new /var/lib/pkgtools/douninst.sh directory, but I
haven't accounted for that yet. I don't think any packages in Slackware
15.0 uses it, yet anyway.
  • Loading branch information
gapan committed Jan 17, 2022
1 parent 3ed3bf8 commit 60f585a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/pkgdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ These functions returns list of package names.
G_BEGIN_DECLS

/** Directory where the package database is stored. */
#define PKGDB_DIR "var/log"
#define PKGDB_DIR "var"

#define DB_NOPEN E(0) /**< Database is not open. */
#define DB_OPEN E(1) /**< Database is already open (when opening). */
Expand Down
17 changes: 11 additions & 6 deletions src/pkgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ static struct db_state _db; // yeah, this is really not uninitialized
gint db_open(const gchar* root, gboolean readonly, struct error* e)
{
gchar** d;
gchar* checkdirs[] = { "packages", "scripts", "removed_packages",
"removed_scripts", "setup", NULL };
gchar* checkdirs[] = {
"lib/pkgtools/packages",
"lib/pkgtools/scripts",
"lib/pkgtools/setup",
"log/pkgtools/removed_packages",
"log/pkgtools/removed_scripts",
NULL };

g_assert(e != NULL);
_db.err = e;
Expand All @@ -85,8 +90,8 @@ gint db_open(const gchar* root, gboolean readonly, struct error* e)
_db.topdir = g_strdup_printf("%s/%s%s", cwd, sane_root, PKGDB_DIR);
g_free(cwd);
}
_db.pkgdir = g_strdup_printf("%s/packages", _db.topdir);
_db.scrdir = g_strdup_printf("%s/scripts", _db.topdir);
_db.pkgdir = g_strdup_printf("%s/lib/pkgtools/packages", _db.topdir);
_db.scrdir = g_strdup_printf("%s/lib/pkgtools/scripts", _db.topdir);
g_free(sane_root);

/* check db dirs */
Expand Down Expand Up @@ -922,8 +927,8 @@ gint db_rem_pkg(gchar* name)

gchar* p = g_strdup_printf("%s/%s", _db.pkgdir, name);
gchar* s = g_strdup_printf("%s/%s", _db.scrdir, name);
gchar* rp = g_strdup_printf("%s/removed_packages/%s-removed-%s", _db.topdir, name, _get_date());
gchar* rs = g_strdup_printf("%s/removed_scripts/%s-removed-%s", _db.topdir, name, _get_date());
gchar* rp = g_strdup_printf("%s/log/pkgtools/removed_packages/%s-removed-%s", _db.topdir, name, _get_date());
gchar* rs = g_strdup_printf("%s/log/pkgtools/removed_scripts/%s-removed-%s", _db.topdir, name, _get_date());

if (sys_file_type(p, 1) != SYS_REG)
{
Expand Down

0 comments on commit 60f585a

Please sign in to comment.