aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2023-04-25 20:24:29 +0200
committerRomain Gonçalves <me@rgoncalves.se>2023-05-03 14:21:51 +0200
commit9d63ca99d03ce3116cd5e6ed92bda2b4753b51f7 (patch)
treea3f8ec00da3941096af9e2f8dfbb2233ccb205fa /bin
parent1d625d1a3214e3eea5716ffd4460902359e7a240 (diff)
downloadwebsite-9d63ca99d03ce3116cd5e6ed92bda2b4753b51f7.tar.gz
feat(bin): use common sha256 executable
Diffstat (limited to 'bin')
-rw-r--r--bin/func8
-rwxr-xr-xbin/rssg9
2 files changed, 8 insertions, 9 deletions
diff --git a/bin/func b/bin/func
index bea9dea..0468b29 100644
--- a/bin/func
+++ b/bin/func
@@ -22,6 +22,12 @@ date_default_timezone="+0200"
uname=$(uname)
+__sha256="sha256"
+
+if [ "${uname}" = "Linux" ]; then
+ __sha256="sha256sum"
+fi
+
__to_html_id() {
cat /dev/stdin | sed 's/ /%20/g'
}
@@ -96,7 +102,7 @@ __get_out_filename() {
_filename="${1}"
if $(__get_value "${1}" draft || false); then
- _filename="$(dirname ${1})/$(basename ${1} | sha256).html"
+ _filename="$(dirname ${1})/$(basename ${1} | "${__sha256}").html"
fi
echo "${_filename}" |
diff --git a/bin/rssg b/bin/rssg
index 02e6b54..b8656c4 100755
--- a/bin/rssg
+++ b/bin/rssg
@@ -5,7 +5,6 @@
set -e
current_date=$(date +"%a, %d %b %Y %H:%M:%S %z")
-uname=$(uname)
cat <<-EOF > "${rss_out_file}"
<rss version="2.0">
@@ -28,13 +27,7 @@ for file in $(__list_files_date "${rss_dir}"); do
title=$(__get_value_title "${file}")
date=$(__get_value_date_publication "${file}")
link="${website_link}/$(__get_final_filename "${file}")"
- description=$(__generate_rss_body "${file}")
- if [ "${uname}" = "Linux" ]; then
- guid="$(echo "${link}" | sha256sum | cut -d ' ' -f 1)"
- else
- guid="$(echo "${link}" | sha256)"
- fi
-
+ guid="$(echo "${link}" | "${__sha256}" | cut -d ' ' -f 1)"
cat <<-EOF >> "${rss_out_file}"
<item>
<title>${title}</title>
remember that computers suck.