From bb327d381e5626d96942a805e6a5f4d4a5a771d5 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Thu, 28 May 2020 02:58:57 -0400 Subject: 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. --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'Makefile') 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 -- cgit 1.4.1-2-gfad0 ge
path: root/506math.mu
blob: 40b8ccdb54d66d9dd5e372b385f0aa51b8a8433e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53