From 87e3aa45c4eddffd41649c23bd177b485a99cfc0 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Tue, 10 Oct 2023 02:01:10 +0000 Subject: [PATCH] Portability bug fixes Now building the site from a Debian-derivative system, as opposed to my Arch PC. This has made several predictable and one very surprising bug. First of all, `gawk` has to be specified rather than `/bin/awk` now. This is a portable change in that `gawk` can be installed on practically any system and is reliably found at `/usr/bin/gawk`. My mistake for thinking all Linux distros used `gawk` for system `awk`... The LaTeX distro for Debian-derivative systems is confusingly broken up, and best solved by just relying on apt install `latex-cjk-all texlive-lang-cjk` to work. As a part of this, I broke up the PDF generation process into separate TeX and PDF file recipes. I forgot that, due to ignored files, a certain directory wasn't created by cloning the repo. Oops. Now that directory is explicitly created by a recipe. Lastly, it seems that there's an important difference in how escaped newlines are interpretted in shell variables between `bash` and `dash`. No idea what the actual reasoning is, but making `bsky.sh` into `bsky.bash` works. --- Makefile | 13 ++++++++++--- scripts/{bsky.sh => bsky.bash} | 6 +++--- scripts/cv_html.awk | 2 +- scripts/cv_tex.awk | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) rename scripts/{bsky.sh => bsky.bash} (90%) diff --git a/Makefile b/Makefile index 9c9feba..36e2b1e 100644 --- a/Makefile +++ b/Makefile @@ -8,19 +8,26 @@ clean: rm -rf scripts/cv.aux scripts/cv.log scripts/cv.out scripts/cv.tex rm -rf content/posts/*.bak -static/files/dominic-ricottone.pdf: content/cv.md +scripts/cv.tex: sed content/cv.md \ -e 's/南山大学/\\begin{CJK}{UTF8}{min}&\\end{CJK}/' \ | scripts/cv_tex.awk > scripts/cv.tex + +static/files: + mkdir -p static/files + +static/files/dominic-ricottone.pdf: static/files content/cv.md scripts/cv.tex cd scripts && pdflatex cv.tex + pwd mv scripts/cv.pdf static/files/dominic-ricottone.pdf + rm -rf scripts/cv.aux scripts/cv.log scripts/cv.out scripts/cv.tex -static/files/dominic-ricottone.html: content/cv.md +static/files/dominic-ricottone.html: static/files content/cv.md cat content/cv.md \ | scripts/cv_html.awk > static/files/dominic-ricottone.html layouts/partials/bsky.html: - scripts/bsky.sh > layouts/partials/bsky.html + scripts/bsky.bash > layouts/partials/bsky.html layouts/partials/lastfm.html: scripts/lastfm.sh > layouts/partials/lastfm.html diff --git a/scripts/bsky.sh b/scripts/bsky.bash similarity index 90% rename from scripts/bsky.sh rename to scripts/bsky.bash index 61f7eec..8fce949 100755 --- a/scripts/bsky.sh +++ b/scripts/bsky.bash @@ -1,15 +1,15 @@ -#!/bin/sh +#!/bin/bash API_PASSWD="$(cat bsky-passwd)" DID_HANDLE='handle=dricottone.bsky.social' DID_URI='https://bsky.social/xrpc/com.atproto.identity.resolveHandle' -DID="$(curl --get --no-progress-meter --data-urlencode "$DID_HANDLE" "$DID_URI" | jq --raw-output .did)" +DID="$(curl --get --no-progress-meter --data-urlencode "$DID_HANDLE" "$DID_URI" | jq --raw-output '.did')" APIKEY_URI='https://bsky.social/xrpc/com.atproto.server.createSession' APIKEY_HEADER='Content-Type: application/json' APIKEY_DATA="{ \"identifier\": \"$DID\", \"password\": \"$API_PASSWD\" }" -APIKEY="$(curl -X POST --no-progress-meter --header "$APIKEY_HEADER" --data "$APIKEY_DATA" "$APIKEY_URI" | jq --raw-output .accessJwt)" +APIKEY="$(curl -X POST --no-progress-meter --header "$APIKEY_HEADER" --data "$APIKEY_DATA" "$APIKEY_URI" | jq --raw-output '.accessJwt')" FEED_URI='https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed' FEED_HEADER="Authorization: Bearer $APIKEY" diff --git a/scripts/cv_html.awk b/scripts/cv_html.awk index 5a76aa6..313a863 100755 --- a/scripts/cv_html.awk +++ b/scripts/cv_html.awk @@ -1,4 +1,4 @@ -#!/bin/awk -f +#!/usr/bin/gawk -f function end_section() { print ""; diff --git a/scripts/cv_tex.awk b/scripts/cv_tex.awk index 90e9a02..686c3aa 100755 --- a/scripts/cv_tex.awk +++ b/scripts/cv_tex.awk @@ -1,4 +1,4 @@ -#!/bin/awk -f +#!/usr/bin/gawk -f function end_introduction() { print "\\end{minipage}"; -- 2.43.4