Skip to content

Commit

Permalink
Merge pull request #2 from YellowJacketLinux/makefile
Browse files Browse the repository at this point in the history
Makefile
  • Loading branch information
YellowJacketLinux authored May 28, 2023
2 parents ed647e3 + 9b7c2db commit 5d31477
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 8 deletions.
43 changes: 43 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
INSTALL
=======

__First__, modify the `yjl-sysusers.json` file for your distribution.
The current setup from github is for [YellowJacket GNU/Linux](YJL-Notes.md)
which I know you are not running because I have not created an installer
for YJL yet.

If you are lucky, the `contrib` directory has a JSON file for your
GNU/Linux distribution that you can use.

See the [yjl-sysusers.json.5](docs/yjl-sysusers.json.5.md) for information
about that file and valid entries.

Your version must be named `yjl-sysusers.json` and in the source directory,
top level where the `functions.py` file is.

__Second__, test your version of the `yjl-sysusers.json` file by running
the following command:

python3 functions.py 000

If your JSON is valid and your properties are valid, a bunch of JSON
will be dumped to screen but the exit status will be 0.

If you have a mistake, there should be a human-readable error message
and the exit status will be 1.

__Third__, look at the Makefile and change anything that is wrong for
your distribution. If your distribution is FHS compliant, nothing
should need changing *unless* you want stuff put in `/usr/local`.

__Fourth__, run the command

make install

More properly when building an RPM package etc.:

DESTDIR=%{buildroot} make install

__Fifth__, if your `yjl-sysusers.json` file is complete for the
static UID/GID assignments of your GNU/Linux distribution, consider
contacting me about adding it to the `contrib` directory.
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Python 3 required
PYTHON = python3
INSTALL = /usr/bin/install
CHMOD = /usr/bin/chmod
SED = /usr/bin/sed
RM = /bin/rm
# Filesystem paths
DATADIR = /usr/share
MANDIR = /usr/share/man
SBINDIR = /usr/sbin
RPMMACRODIR = /usr/lib/rpm/macros.d

dummy:
echo "run make install"

install: install-macros install-man install-json install-program

install-macros:
$(INSTALL) -Dm644 macros.yjl-sysusers $(DESTDIR)$(RPMMACRODIR)/macros.yjl-sysusers

install-man:
$(INSTALL) -Dm644 docs/yjl-sysusers.8 $(DESTDIR)$(MANDIR)/man8/yjl-sysusers.8
$(INSTALL) -Dm644 docs/yjl-sysusers.json.5 $(DESTDIR)$(MANDIR)/man5/yjl-sysusers.json.5

install-json:
$(INSTALL) -d $(DESTDIR)$(DATADIR)/yjl-sysusers
$(PYTHON) functions.py 000 > $(DESTDIR)$(DATADIR)/yjl-sysusers/yjl-sysusers.json
$(CHMOD) 0444 $(DESTDIR)$(DATADIR)/yjl-sysusers/yjl-sysusers.json

install-program:
$(INSTALL) -d $(DESTDIR)$(SBINDIR)
$(SED) -e s?"cfgdir = ''"?"cfgdir = '$(DATADIR)/yjl-sysusers'"? < functions.py > $(DESTDIR)$(SBINDIR)/yjl-sysusers
$(CHMOD) 0750 $(DESTDIR)$(SBINDIR)/yjl-sysusers

uninstall:
$(RM) -f $(DESTDIR)$(RPMMACRODIR)/macros.yjl-sysusers
$(RM) -f $(DESTDIR)$(MANDIR)/man8/yjl-sysusers.8
$(RM) -f $(DESTDIR)$(MANDIR)/man5/yjl-sysusers.json.5
$(RM) -f $(DESTDIR)$(DATADIR)/yjl-sysusers/yjl-sysusers.json
$(RM) -f $(DESTDIR)$(SBINDIR)/yjl-sysusers
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
yjl-sysusers
============

__VERSION 0.1.0 PRE-RELEASE__

For installation instructions, see [INSTALL.md](INSTALL.md)

This project includes a single utility and a JSON file. In the git
source, that utility is simply called `functions.py` but it gets
installed as `/usr/sbin/yjl-sysusers` with a single-line change
Expand Down
4 changes: 4 additions & 0 deletions contrib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Because I need something
# while empty, go with Ada...
*.o
*.ali
4 changes: 2 additions & 2 deletions docs/yjl-sysusers.8
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ without the need to assign them manually\&.
Static UID and GID values, as well as some other parameters useful to
the \fBuseradd (8)\fR command, are defined in the file
\fByjl\-sysusers\&.json (5)\fR which is normally located in the directory
/var/lib/yjl\-sysusers\&.
/usr/share/yjl\-sysusers\&.
.PP
\fByjl\-sysusers\fR was developed with RPM package scriptlets in
mind\&.
Expand Down Expand Up @@ -221,7 +221,7 @@ The Python 3 wrapper to \fBgroupadd (8)\fR and \fBuseradd (8)\fR\&.
This man page describes use of that Python wrapper.
.RE
.PP
/var/lib/yjl\-sysusers/yjl\-sysusers\&.json
/usr/share/yjl\-sysusers/yjl\-sysusers\&.json
.RS 4
The JSON database on a per-\fIaccount\fR basis for preferred
static UID/GID and default options to pass to \fBuseradd (8)\fR\&.
Expand Down
4 changes: 2 additions & 2 deletions docs/yjl-sysusers.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ without the need to assign them manually.

Static UID and GID values, as well as some other parameters useful to
the `useradd (8)` command, are defined in the file `yjl-sysusers.json
(5)` which is normally located in the directory `/var/lib/yjl-sysusers`.
(5)` which is normally located in the directory `/usr/share/yjl-sysusers`.

`yjl-sysusers` was developed with RPM package scriptlets in mind.

Expand Down Expand Up @@ -187,7 +187,7 @@ FILES
The Python 3 wrapper to `groupadd (8)` and `useradd (8)`. This man
page describes use of that Python wrapper.

* `/var/lib/yjl-sysusers/yjl-sysusers.json`
* `/usr/share/yjl-sysusers/yjl-sysusers.json`
The JSON database on a per-*account* basis for preferred static UID/GID
and default options to pass to `useradd (8)`.

Expand Down
4 changes: 2 additions & 2 deletions docs/yjl-sysusers.json.5
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ utility handles dynamically assigned system UID and GID numbers\&.
Ordinarily this file should be installed as:
.sp
.RS 8
\fB/var/lib/yjl\-sysusers/yjl\-sysusers\&.json\fR
\fB/usr/share/yjl\-sysusers/yjl\-sysusers\&.json\fR
.RE
.PP
The file is a configuration file but it is also a read-only database
Expand Down Expand Up @@ -378,7 +378,7 @@ be validated during package creation\&.
.PP
.\" --- end modification
.SH FILES
/var/lib/yjl\-sysuers/yjl\-sysusers\&.json
/usr/share/yjl\-sysuers/yjl\-sysusers\&.json
.\" ---
.PP
.\" --- end files
Expand Down
4 changes: 2 additions & 2 deletions docs/yjl-sysusers.json.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FILE LOCATION

Ordinarily this file should be installed as:

/var/lib/yjl-sysusers/yjl-sysusers.json
/usr/share/yjl-sysusers/yjl-sysusers.json

The file is a configuration file but it is also a read-only database and
once installed it should not be modified except by re-installation of
Expand Down Expand Up @@ -280,7 +280,7 @@ during package creation.
FILES
-----

/var/lib/yjl-sysuers/yjl-sysusers.json
/usr/share/yjl-sysuers/yjl-sysusers.json



Expand Down

0 comments on commit 5d31477

Please sign in to comment.