Skip to content

Instantly share code, notes, and snippets.

@furandon-pig
Created December 3, 2023 08:20
Show Gist options
  • Save furandon-pig/db56ababde6425010427d3e9bc7b6d0a to your computer and use it in GitHub Desktop.
Save furandon-pig/db56ababde6425010427d3e9bc7b6d0a to your computer and use it in GitHub Desktop.
NetBSD-currentの配布物を展開するスクリプトです。
#!/bin/sh
#
# http://www.jp.netbsd.org/ja/docs/current/
usage() {
cat <<_EOF
usage:
$ ./install-current-release.sh <-d|--dist> <DIST_DIR>
_EOF
}
dist_dir=""
while [ ! -z "$1" ]
do
case "$1" in
-d|--dist)
shift
if [ -z "$1" ]; then
echo "Error: too few argument."
usage
exit 1
fi
dist_dir=$1
;;
*)
;;
esac
shift
done
if [ -z "$dist_dir" -o ! -d $dist_dir ]; then
echo "Error: please spcify 'dist' directory."
usage
exit 1
fi
DIST="
base.tar.xz
comp.tar.xz
man.tar.xz
misc.tar.xz
modules.tar.xz
"
cd $dist_dir
for i in $DIST
do
if [ -f $i ]; then
echo "[`LANG=C date`] extract ${i}..."
tar Jxfp $i -C /
fi
done
echo "[`LANG=C date`] /usr/sbin/postinstall -s etc.tar.xz check"
/usr/sbin/postinstall -s etc.tar.xz check
echo "[`LANG=C date`] /usr/sbin/postinstall -s etc.tar.xz fix"
/usr/sbin/postinstall -s etc.tar.xz fix
cat <<_EOF
Please execute 'etcupdate' and reboot.
# /usr/sbin/etcupdate -s ~/etc.tgz
# shutdown -r now
_EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment