-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathckup
More file actions
executable file
·27 lines (22 loc) · 753 Bytes
/
ckup
File metadata and controls
executable file
·27 lines (22 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# ckup - check for new openbsd version and download new sets
arch="$(sysctl -n hw.machine)"
directory="${HOME}/.$(basename ${0})"
mirror='ftp://ftp3.usa.openbsd.org/pub/OpenBSD'
version='snapshots'
url="${mirror}/${version}/${arch}"
if [ ! -e "${directory}" ]; then
mkdir -p "${directory}"
fi
cd "${directory}"
ftp -aiMVo "${directory}"/SHA256.new "${url}"/SHA256
if cmp -s "${directory}"/SHA256 "${directory}"/SHA256.new; then
rm "${directory}"/SHA256.new
echo 'No changes.'
else
echo 'Updates found. Downloading new sets...'
mv "${directory}"/SHA256.new "${directory}"/SHA256
ftp -aiV "${url}"/{INSTALL*,SHA256.sig,*tgz,bsd*}
doas cp "${directory}"/bsd.rd /bsd.rd
echo "/bsd.rd updated; new sets downloaded to ${directory}."
fi