mirror of
https://github.com/mrrpnya/lipu-sona.git
synced 2025-02-13 16:44:39 +00:00
added upload.sh
This commit is contained in:
parent
e62c3cd9d1
commit
ea486d626a
4 changed files with 55 additions and 3 deletions
4
Makefile
4
Makefile
|
@ -20,14 +20,14 @@ OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC))
|
|||
|
||||
all: $(PAGES_HTML) $(OUT_STATIC)
|
||||
|
||||
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
|
||||
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl $(OUTDIR)
|
||||
theme -t $(TPLDIR)/default.tpl -o $@ $<
|
||||
|
||||
$(OUTDIR)/%: static/%
|
||||
cp -r $< $@
|
||||
|
||||
$(OUTDIR):
|
||||
mkdir $(OUTDIR)
|
||||
mkdir -p $(OUTDIR)
|
||||
|
||||
clean:
|
||||
rm -rf out/*
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Simple site template
|
||||
|
||||
An attempt to use makefiles, markdown and maybe a bit of C preprocessing to make a static website.
|
||||
An attempt to use makefiles, markdown and a bit of bash to make a simple static website and easily upload it to neocities.
|
||||
|
|
|
@ -41,3 +41,25 @@ body a:visited {
|
|||
font-family: sans-serif:
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.info {
|
||||
border-left: 4px solid #3465a4;
|
||||
background:#729fcf;
|
||||
}
|
||||
|
||||
.warning {
|
||||
border-left: 4px solid #c4a000;
|
||||
background:#fce94f;
|
||||
}
|
||||
|
||||
.error {
|
||||
border-left: 4px solid #a40000;
|
||||
background:#cc0000;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.error a, .error a:visited {
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
|
|
30
upload.sh
Executable file
30
upload.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! [[ -f upload.pwd ]]; then
|
||||
echo "You need a file named upload.pwd with the following format:"
|
||||
echo "N_USER=[your neocities username]"
|
||||
echo "N_PWD=[your neocities password]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source ./upload.pwd
|
||||
|
||||
LASTUPLOAD=`stat -c %Y upload.lasttime 2>/dev/null`
|
||||
if [[ -z $LASTUPLOAD ]]; then LASTUPLOAD=0; fi
|
||||
|
||||
echo "Last upload at $LASTUPLOAD"
|
||||
|
||||
FILES=`find out/ -type f`
|
||||
|
||||
for f in $FILES; do
|
||||
MTIME=`stat -c %Y $f`
|
||||
#echo "MTIME for $f: $MTIME"
|
||||
if [[ $MTIME -gt $LASTUPLOAD ]]; then
|
||||
REMOTENAME="${f#out/}"
|
||||
echo "Uploading $REMOTENAME..."
|
||||
curl -F "$REMOTENAME=@$f" "https://$N_USER:$N_PWD@neocities.org/api/upload"
|
||||
fi
|
||||
done
|
||||
|
||||
touch upload.lasttime
|
||||
|
Loading…
Add table
Reference in a new issue