Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Pkg: add post-install-doc, fmt version 11
Browse files Browse the repository at this point in the history
  • Loading branch information
minexew committed Mar 26, 2017
1 parent cdb6e0b commit 4c5d14f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 14 additions & 1 deletion PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The manifest is a key-value format, using exactly one Tab character as delimiter
- `installdir` (string, default *NULL*)
- `iso.c` (string - see below, default *NULL*)
- `size` (int - download size in bytes, default 0)
- `post-install-doc` (string, default *NULL*)

Name of file to open after package installation. Must be an absolute path.

Currently ignored keys:

Expand All @@ -37,7 +40,17 @@ This is somewhat confusing, which makes it a perfect fit for TempleOS.

`size` is ambiguous if the package provides multiple download formats. It's not a big deal.

pkgmin
------

To maximize compatibility with systems in the wild, you should generally use the lowest `pkgmin` that's suitable for your package.

Format versions are described below:

- 10 - Initial public release
- 11 - Adds support for `post-install-doc` (Shrine 5.03.1)

Dependency resolution
---------------------

...is not implemented on purpose, to keep things simple.
...is omitted on purpose, to keep things simple.
11 changes: 10 additions & 1 deletion Pkg/Pkg.HC
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define PKG_EOSVERSION (-20005)
#define PKG_EUNSUITABLE (-20006)

#define PKG_VERSION 10
#define PKG_VERSION 11

static U8* PKG_BASE_URL = "http://shrineupd.clanweb.eu/packages";
static U8* PKG_LOCAL_REPO = "::/Misc/Packages";
Expand All @@ -25,6 +25,7 @@ class CPkgInfo {
U8* version;
U8* installdir;
U8* iso_c;
U8* post_install_doc;
};

// TODO: Is there a built-in for this?
Expand All @@ -49,13 +50,15 @@ U0 PkgInfoInit(CPkgInfo* pinf) {
pinf->version = 0;
pinf->installdir = 0;
pinf->iso_c = 0;
pinf->post_install_doc = 0;
}

U0 PkgInfoFree(CPkgInfo* pinf) {
Free(pinf->package_name);
Free(pinf->version);
Free(pinf->installdir);
Free(pinf->iso_c);
Free(pinf->post_install_doc);
PkgInfoInit(pinf);
}

Expand Down Expand Up @@ -93,6 +96,7 @@ I64 PkgParseManifest(CPkgInfo* pinf, U8* manifest) {
else if (!StrCmp(key, "version")) { Free(pinf->version); pinf->version = StrNew(value); }
else if (!StrCmp(key, "installdir")) { Free(pinf->installdir); pinf->installdir = StrNew(value); }
else if (!StrCmp(key, "iso.c")) { Free(pinf->iso_c); pinf->iso_c = StrNew(value); }
else if (!StrCmp(key, "post-install-doc")) { Free(pinf->post_install_doc); pinf->post_install_doc = StrNew(value); }
else { /* unrecognized keys are simply ignored */ }

key = end;
Expand Down Expand Up @@ -209,6 +213,11 @@ I64 PkgInstallISOC(CPkgInfo* pinf, U8* iso_c) {

// Register package as installed
error = PkgRegister(pinf);

// Display post-install doc
if (pinf->post_install_doc) {
Ed(pinf->post_install_doc);
}
}
else
error = PKG_EMOUNT;
Expand Down

0 comments on commit 4c5d14f

Please sign in to comment.