diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-05-28 02:58:57 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-05-28 02:58:57 -0400 |
commit | bb327d381e5626d96942a805e6a5f4d4a5a771d5 (patch) | |
tree | c7e86c2a6ea8dc67be2221e8517806f365aac088 /Makefile | |
parent | e4af0011c04e2861e4f890bcb7383f9c87e35126 (diff) | |
download | clinte-bb327d381e5626d96942a805e6a5f4d4a5a771d5.tar.gz |
extensive rewrite to use json for storage:
sqlite3 requires the directory where the database resides to be writeable by the user. This presents a problem on multiuser UNIX systems where they may want to limit areas where users have write access. This rewrite totally scraps the sqlite3 database in favor of a pretty simple json file consisting of an array of posts. flock(2) locking is used to synchronize access to the file and make sure two clients aren't trying to write to it at once. The locking is fairly granular right now, but later I may change it to using a single lock for the duration of execution since race conditions are *possible*, if unlikely for the purposes of clinte's intended use.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Makefile b/Makefile index 14fce88..4545bc7 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ BINDIR?=$(_INSTDIR)/bin DBDIR?=$(_INSTDIR)/clinte clinte: + @printf "\n%s\n" "Checking out latest tag..." + git checkout $(git describe --tags --abbrev=0) + @printf "\n%s\n" "Building clinte. This may take a minute or two." cargo build --release @printf "\n%s\n" "...Done!" @@ -16,21 +19,33 @@ clean: .PHONY: update update: + @printf "\n%s\n" "Making sure we're on master..." + git checkout master + @printf "\n%s\n" "Updating from upstream repository..." git pull --rebase + + @printf "\n%s\n" "Checking out latest tag..." + git checkout $(git describe --tags --abbrev=0) + @printf "\n%s\n" "...Done!" .PHONY: install install: @printf "\n%s\n" "Installing clinte..." @printf "\n%s\n" "Creating directories..." - mkdir -p $(BINDIR) mkdir -p $(DBDIR) + @printf "\n%s\n" "Copying files..." install -m755 target/release/clinte $(BINDIR) - touch $(DBDIR)/clinte.db - chmod 666 $(DBDIR)/clinte.db - chmod 777 $(DBDIR) + install -m666 clinte.json $(DBDIR) + + @printf "\n%s\n" "...Done!" + +.PHONY: upgrade +upgrade: + @printf "\n%s\n" "Upgrading clinte..." + install -m755 target/release/clinte $(BINDIR) @printf "\n%s\n" "...Done!" .PHONY: test |