4 Commits 28b5ea383f ... dc39e25713

Author SHA1 Message Date
  Joshua Branson dc39e25713 openbsd/openbsd-pkg-list: new file. 1 year ago
  Joshua Branson 01b564cae1 gnu/guile/scripts/attach: tiny comment change. 1 year ago
  Joshua Branson c0844084ab sh/battery: new file. 1 year ago
  Joshua Branson 1c44c1c39c gnu/guile/scripts/attach: attach now auto mounts all disk sticks with an 1 year ago
3 changed files with 72 additions and 10 deletions
  1. 16 10
      gnu/guile/scripts/attach
  2. 35 0
      openbsd/openbsd-pkg-list
  3. 21 0
      sh/battery

+ 16 - 10
gnu/guile/scripts/attach

@@ -3,28 +3,34 @@
 !#
 
 ;;; This is a simple script that automounts your usb stick to /mnt/usb
+;; see man hotplugd for more info
+;;;
+;;; To easily test this script execute
+;;; doas ./attach 2 "sd2"
+;;;
 ;;; TODO make it more robust:
 ;;; https://github.com/a12n/openbsd-hotplug/blob/master/hotplug.pl
+;;; Should I check to make sure the label is "USB Flash Drive"?
+;;; or is "USB Flash Drive" not guarenteed to be there all the time
+;;; for all USB Flash Drives?
 
 (use-modules (rnrs io ports))
 (use-modules (ice-9 popen))
 
-(define (label name)
+(define (fs-type-and-partition name)
   (let* ((port (open-input-pipe
-                (string-append "/sbin/disklabel " name " 2>&1 | \
-                       sed -n '/^label: /s/^label: //p'")))
-         (str (get-line port)))
+                (string-append "/sbin/disklabel -t " name " 2>&1 | \
+                       grep -e ':t[ab]=' -e ':t[d-p]'| cut -f 4 -d ':'")))
+         (str (string-drop-right (get-line port) 1)))
     (close-pipe port)
-    (substring str 0 15)))
+    str))
 
 (define (main args)
   (define class (car (cdr args)))
   (define name (car (cddr args)))
-  (define label-string (label name))
 
-  ;; when this is a disk drive with a flash drive label, mount it
-  ;; see man hotplugd for more info
+  ;; when this is a disk drive with a filesystem of msdos, mount it
   (when (and (string=? "2" class)
-             (string=? label-string "USB Flash Drive"))
+             (fs-type-msdos? name))
     (display "mounting")
-    (system* "mount" "-o" "nodev,nosuid" (string-append "/dev/" name "i") "/mnt/usb")))
+    (system* "mount" "-o" "rw,nodev,noexec,nodev" (string-append "/dev/" name "i") "/mnt/usb")))

+ 35 - 0
openbsd/openbsd-pkg-list

@@ -0,0 +1,35 @@
+at-spi2-core--
+autoconf--%2.71
+automake--%1.16
+chromium--
+dino--
+emacs--gtk3%emacs
+evince--light
+firefox--
+fish--
+font-awesome--
+git--
+gnupg--
+gtk+3--
+gtk+3-cups--
+guile3--
+hack-fonts--
+i3--
+isync--
+libreoffice--
+linphone--
+mpv--
+netsurf--
+obsdfreqd--
+pinentry-gnome3--
+polybar--
+qbittorrent--
+qtbase--
+quirks--
+ripgrep--
+scheme48--
+tor-browser--
+xfce4-appfinder--
+xfce4-dict--
+xfce4-screenshooter--
+xfce4-terminal--

+ 21 - 0
sh/battery

@@ -0,0 +1,21 @@
+#!/usr/bin/env sh
+
+BATTERY_LEVEL=`apm -l`
+# 1 is charging & 0 is discharging
+CHARGING=`apm -a`
+
+if [ $BATTERY_LEVEL -gt 95 ]
+then
+    echo ;
+elif [ $BATTERY_LEVEL -gt 70 ]
+then
+    echo ;
+elif [ $BATTERY_LEVEL -gt 45 ]
+then
+    echo ;
+elif [ $BATTERY_LEVEL -gt 20 ]
+then
+    echo ;
+else
+    echo 
+fi