Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24578940
D3960.id10262.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D3960.id10262.diff
View Options
diff --git a/roles/devserver/userland-home/files/dereckson/bin/check-pefs b/roles/devserver/userland-home/files/dereckson/bin/check-pefs
new file mode 100755
--- /dev/null
+++ b/roles/devserver/userland-home/files/dereckson/bin/check-pefs
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Detect pefs filesystem
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+set -e
+
+# -------------------------------------------------------------
+# Parse arguments
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ $# -eq 0 ]; then
+ echo "Usage: $(basename "$0") <mount point>" >&2
+ exit 1
+fi
+
+PEFS_MOUNT=$1
+
+# -------------------------------------------------------------
+# Directory check
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ ! -d $PEFS_MOUNT ]; then
+ echo "Directory doesn't exist." >&2
+ exit 2
+fi
+
+# -------------------------------------------------------------
+# PEFS keys check
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+set +e
+PEFS_SHOWKEYS_STDOUT=$(pefs showkeys "$PEFS_MOUNT" 2>/tmp/pefs_err.$$)
+PEFS_SHOWKEYS_EXIT_CODE=$?
+PEFS_SHOWKEYS_STDERR=$(cat /tmp/pefs_err.$$)
+rm -f /tmp/pefs_err.$$
+set -e
+
+if [ "$PEFS_SHOWKEYS_STDOUT" = "No keys specified" ]; then
+ echo "[PEFS] $PEFS_MOUNT is mounted, but without any active key. To unmount: pefs unmount $PEFS_MOUNT"
+ exit 0
+fi
+
+if [ "$PEFS_SHOWKEYS_EXIT_CODE" -eq 7 ]; then
+ # The specified mount point isn't a PEFS filesystem so all is ine
+ exit 0
+fi
+
+if [ "$PEFS_SHOWKEYS_EXIT_CODE" -ne 0 ]; then
+ echo $PEFS_SHOWKEYS_STDERR >&2
+ exit $PEFS_SHOWKEYS_EXIT_CODE
+fi
+
+echo "[PEFS] $PEFS_MOUNT is mounted and active. To unmount once you're done: pefs unmount $PEFS_MOUNT"
+exit 0
diff --git a/roles/devserver/userland-home/files/dereckson/bin/hunt-insecable-spaces b/roles/devserver/userland-home/files/dereckson/bin/hunt-insecable-spaces
new file mode 100755
--- /dev/null
+++ b/roles/devserver/userland-home/files/dereckson/bin/hunt-insecable-spaces
@@ -0,0 +1,4 @@
+rg --colors 'match:bg:yellow' -C 1 ' '
+
+# Fix
+rg -l " " | xargs gsed -i "s/ / /g"
diff --git a/roles/devserver/userland-home/files/dereckson/bin/ruler b/roles/devserver/userland-home/files/dereckson/bin/ruler
new file mode 100755
--- /dev/null
+++ b/roles/devserver/userland-home/files/dereckson/bin/ruler
@@ -0,0 +1,65 @@
+#!/usr/bin/env tclsh8.6
+
+set DEFAULT_LEN 80
+
+proc spaces_for_dozen {n} {
+ string repeat " " [expr 10 - [string length $n]]
+}
+
+proc ruler {len} {
+ set i 0
+ set tens [expr $len / 10]
+
+ set line_units ""
+ set line_tens ""
+
+ # First, build our ruler string by appending groups of 10 digits
+ while {$i < $tens} {
+ incr i
+
+ append line_units "1234567890"
+
+ append line_tens [spaces_for_dozen $i]
+ append line_tens $i
+ }
+
+ # Then, adds units for our last group if needed
+ set remaining_units [expr $len % 10]
+ for {set i 1} {$i <= $remaining_units} {incr i} {
+ append line_units $i
+ }
+
+ # Prints the lines
+ join [list $line_units $line_tens] "\n"
+}
+
+#
+# Parses arguments
+#
+
+proc usage {} {
+ set command [file tail [info script]]
+
+ puts stderr "Usage: $command \[len\]"
+ puts stderr "Print a ruler of specified length."
+}
+
+if {$argc == 0} {
+ set len $DEFAULT_LEN
+} elseif {$argc == 1} {
+ set len $argv
+
+ if {![string is integer $len]} {
+ usage
+ exit 2
+ }
+} {
+ usage
+ exit 1
+}
+
+#
+# Procedural part
+#
+
+puts [ruler $len]
diff --git a/roles/devserver/userland-home/files/dereckson/bin/vault-login b/roles/devserver/userland-home/files/dereckson/bin/vault-login
new file mode 100755
--- /dev/null
+++ b/roles/devserver/userland-home/files/dereckson/bin/vault-login
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+touch $HOME/.vault-token
+chmod 600 $HOME/.vault-token
+ssh complector sudo /opt/salt/nasqueron-operations/utils/vault/issue-admin-token.py | tr -d '\n' > $HOME/.vault-token
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 1, 05:14 (17 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3483152
Default Alt Text
D3960.id10262.diff (4 KB)
Attached To
Mode
D3960: Add helper personal devserver scripts for dereckson
Attached
Detach File
Event Timeline
Log In to Comment