Update_hugo

Page content

how to update hugo

you can use ports (pkg_add hugo) and get the lastest stable hugo package based on OpenBSD release cycles (2 x year), or grab the latest binary from github and put it on your machine.

Releases: https://github.com/gohugoio/hugo/releases

cd /tmp
ftp https://github.com/gohugoio/hugo/releases/download/v0.62.0/hugo_0.62.0_OpenBSD-64bit.tar.gz
tar xfz hugo_0.62.0_OpenBSD-64bit.tar.gz
doas mv hugo /usr/local/bin/

or find latest automatically

doas su -
cd /tmp/
u=$(lynx -dump -listonly https://github.com/gohugoio/hugo/releases/latest |grep "OpenBSD-64bit" |sed 's/.*https/https/')
f=$(echo $u |sed 's/.*\///')
ftp $u
tar xfz $f
doas mv hugo /usr/local/bin/
rm $f

or extract automatically

cd /tmp/
u=$(lynx -dump -listonly https://github.com/gohugoio/hugo/releases/latest |grep "OpenBSD-64bit" |sed 's/.*https/https/')
ftp -V -o - $u |tar xfz -
doas mv hugo /usr/local/bin/

or with version checker

url=$(lynx -dump -listonly https://github.com/gohugoio/hugo/releases/latest |grep "OpenBSD-64bit" |sed 's/.*https/https/')
cur=$(hugo version |awk '{print $5}' |sed 's/-.*//'); new=$(echo $url |awk -F'/' '{print $8}');
if [[ $new == $cur ]]; then echo "already up2date ..."; else echo "let's update (ca. 2min) ..."; cd /tmp; ftp -V -o - $url |tar xfz -; doas mv hugo /usr/local/bin/; fi

or compact

doas su -
mkdir -p /root/bin/; cd /root/bin/
ftp https://puffy.nolink.ch/files/update_hugo.sh >/dev/null; chmod 755 update_hugo.sh
./update_hugo.sh

sha256: a3bd268e08c001884bf62a01dd82f2e1dc984d3b0b1263e0aaf4b83bf2a4e178