From 1a5cd2c7e2792d623f59dcd5f3fd60ebfa40fcee Mon Sep 17 00:00:00 2001
From: M33 <327-m33@git.qoto.org>
Date: Fri, 9 Dec 2022 09:53:19 +0000
Subject: [PATCH] Add new file

---
 comfy.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 comfy.sh

diff --git a/comfy.sh b/comfy.sh
new file mode 100644
index 0000000..346ee37
--- /dev/null
+++ b/comfy.sh
@@ -0,0 +1,56 @@
+#!/bin/sh 
+#
+# comfy-netbsd.sh - Get comfy on NetBSD
+#
+#
+
+# Get architecture, relase etc to build repository path
+ARCH=`grep MACHINE_ARCH /etc/release | awk '{print $3}' | sed "s/'//g"`
+VER=`grep DISTRIBVER    /etc/release | awk '{print $3}' | sed "s/'//g"`
+
+# Package list to be installed, as you see fit
+PKGLIST="wget nano free vim tmux bash curl sudo psmisc mtr htop mozilla-rootcerts* git alpine elinks"
+
+# Path to prebuild binnary packages, using http because at this point we don't have root ca certificates
+export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$ARCH/$VER/All/"
+
+TEMP_DIR=/tmp/comfy
+mkdir -p $TEMP_DIR || exit 1
+cd $TEMP_DIR || exit 1
+TEMP=$TEMP_DIR/comfy.tmp.$$
+
+echo "Initial setup, installing pkgin..."
+ftp -p ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$ARCH/$VER/All/pkgin-*.tgz || exit 1
+ftp -p ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$ARCH/$VER/All/pkg_install-20*.tgz || exit 1
+pkg_add `ls pkgin-*.tgz`
+
+# Setup pkgin repository for this system
+cat /usr/pkg/etc/pkgin/repositories.conf | sed 's/^ftp/# disabled by comfy: ftp/' > /usr/pkg/etc/pkgin/repositories.conf.1
+cat /usr/pkg/etc/pkgin/repositories.conf.1 > /usr/pkg/etc/pkgin/repositories.conf
+rm /usr/pkg/etc/pkgin/repositories.conf.1
+
+echo "ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/\$arch/\$osrelease/All" > /usr/pkg/etc/pkgin/repositories.conf
+echo "Updating pkgin database with current prebuilt binnaires..."
+
+pkgin update || exit 1
+
+echo "Listing available packages..."
+pkgin avail > $TEMP
+
+echo "Entering the package install loop..."
+echo " "
+
+for p in $PKGLIST; do
+  grep "^$p\-" $TEMP | head -n 1
+  echo -n "Install $p ? (y/n) "
+  read r
+  if [ "$r" = "y" ]; then
+    pkgin -y install $p
+  fi
+  echo " "
+done
+
+cd $HOME
+rm -fr $TEMP_DIR
+echo "bye!"
+exit 0
-- 
GitLab