Update_hugo

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://blog.stoege.net/files/update_hugo.sh >/dev/null; chmod 755 update_hugo.sh
./update_hugo.sh

Any Comments ?

sha256: 4de8a7b967342b07be70e2d30004d5df02bcaf922daf002cd0a7f024b4234fd9