2016-04: Retroactive Updates

* Added HFS+ to udevil's allowed types.
* Added mediainfo to meet photorec-sort requirements
* Removed git
* Switched out Chromium for Midori
  * Size reduction test
* hw-diags now tests USB drives (except ARCH drives)
* mount-all-volumes no longer opens the file browser

Bugfix: mount-backup-shares should now work.
This commit is contained in:
Alan Mason 2017-12-06 17:44:12 -08:00
parent d37e453643
commit 10a70e5192
48 changed files with 1491 additions and 62 deletions

View file

@ -1 +1 @@
archiso
arch-wk

View file

@ -0,0 +1,64 @@
# LightDM GTK+ Configuration
# Available configuration options listed below.
#
# Appearance:
# theme-name = GTK+ theme to use
# icon-theme-name = Icon theme to use
# background = Background file to use, either an image path or a color (e.g. #772953)
# user-background = false|true ("true" by default) Display user background (if available)
# transition-duration = Length of time (in milliseconds) to transition between background images ("500" by default)
# transition-type = ease-in-out|linear|none ("ease-in-out" by default)
#
# Fonts:
# font-name = Font to use
# xft-antialias = false|true Whether to antialias Xft fonts
# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
# xft-hintstyle = none|slight|medium|hintfull What degree of hinting to use
# xft-rgba = none|rgb|bgr|vrgb|vbgr Type of subpixel antialiasing
#
# Login window:
# active-monitor = Monitor to display greeter window (name or number). Use #cursor value to display greeter at monitor with cursor. Can be a semicolon separated list
# position = x y ("50% 50%" by default) Login window position
# default-user-image = Image used as default user icon, path or #icon-name
# hide-user-image = false|true ("false" by default)
#
# Panel:
# panel-position = top|bottom ("top" by default)
# clock-format = strftime-format string, e.g. %H:%M
# indicators = semi-colon ";" separated list of allowed indicator modules. Built-in indicators include "~a11y", "~language", "~session", "~power", "~clock", "~host", "~spacer". Unity indicators can be represented by short name (e.g. "sound", "power"), service file name, or absolute path
#
# Accessibility:
# a11y-states = states of accessibility features: "name" - save state on exit, "-name" - disabled at start (default value for unlisted), "+name" - enabled at start. Allowed names: contrast, font, keyboard, reader.
# keyboard = command to launch on-screen keyboard (e.g. "onboard")
# keyboard-position = x y[;width height] ("50%,center -0;50% 25%" by default) Works only for "onboard"
# reader = command to launch screen reader (e.g. "orca")
#
# Security:
# allow-debugging = false|true ("false" by default)
# screensaver-timeout = Timeout (in seconds) until the screen blanks when the greeter is called as lockscreen
#
# Template for per-monitor configuration:
# [monitor: name]
# background = overrides default value
# user-background = overrides default value
# laptop = false|true ("false" by default) Marks monitor as laptop display
# transition-duration = overrides default value
#
[greeter]
background=/usr/share/wallpaper/wallhaven-105688.png
#user-background=
theme-name=Numix
icon-theme-name=Numix-Circle-Light
font-name=Noto-Sans
#xft-antialias=
#xft-dpi=
#xft-hintstyle=
#xft-rgba=
hide-user-image=true
#indicators=
clock-format=%H:%M
#keyboard=
#reader=
#position=50%,center 100%,bottom
position=5% 45%,center
#screensaver-timeout=

View file

@ -0,0 +1,163 @@
#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# lock-memory = True to prevent memory from being paged to disk
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# logind-check-graphical = True to on start seats that are marked as graphical by logind
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# sessions-directory = Directory to find sessions
# remote-sessions-directory = Directory to find remote sessions
# greeters-directory = Directory to find greeters
# backup-logs = True to move add a .old suffix to old log files when opening new ones
#
[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7 # Setting this to a value < 7 implies security issues, see FS#46799
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#logind-check-graphical=false
#log-directory=/var/log/lightdm
run-directory=/run/lightdm
#cache-directory=/var/cache/lightdm
#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions:/usr/share/wayland-sessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=/usr/share/lightdm/greeters:/usr/share/xgreeters
#backup-logs=true
#
# Seat configuration
#
# Seat configuration is matched against the seat name glob in the section, for example:
# [Seat:*] matches all seats and is applied first.
# [Seat:seat0] matches the seat named "seat0".
# [Seat:seat-thin-client*] matches all seats that have names that start with "seat-thin-client".
#
# type = Seat type (xlocal, xremote, unity)
# pam-service = PAM service to use for login
# pam-autologin-service = PAM service to use for autologin
# pam-greeter-service = PAM service to use for greeters
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xmir-command = Xmir server command to run (can also contain arguments e.g. Xmir -special-option)
# xserver-config = Config file to pass to X server
# xserver-layout = Layout to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xserver-share = True if the X server is shared for both greeter and session
# xserver-hostname = Hostname of X server (only for type=xremote)
# xserver-display-number = Display number of X server (only for type=xremote)
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# unity-compositor-command = Unity compositor command to run (can also contain arguments e.g. unity-system-compositor -special-option)
# unity-compositor-timeout = Number of seconds to wait for compositor to start
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# greeter-show-remote-login = True if the greeter should offer a remote login option
# user-session = Session to load for users
# allow-user-switching = True if allowed to switch users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# greeter-wrapper = Wrapper script to run greeter with
# guest-wrapper = Wrapper script to run guest sessions with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# display-stopped-script = Script to run after stopping the display server (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# autologin-in-background = True if autologin session should not be immediately activated
# exit-on-failure = True if the daemon should exit if this seat fails
#
[Seat:*]
#type=xlocal
pam-service=lightdm
pam-autologin-service=lightdm-autologin
#pam-greeter-service=lightdm-greeter
#xserver-command=X
#xmir-command=Xmir
#xserver-config=
#xserver-layout=
#xserver-allow-tcp=false
#xserver-share=true
#xserver-hostname=
#xserver-display-number=
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
#unity-compositor-command=unity-system-compositor
#unity-compositor-timeout=60
#greeter-session=example-gtk-gnome
#greeter-hide-users=false
#greeter-allow-guest=true
#greeter-show-manual-login=false
#greeter-show-remote-login=true
#user-session=default
#allow-user-switching=true
#allow-guest=true
#guest-session=
session-wrapper=/etc/lightdm/Xsession
#greeter-wrapper=
#guest-wrapper=
#display-setup-script=
#display-stopped-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
autologin-user=wktech
autologin-user-timeout=0
#autologin-in-background=false
#autologin-session=
#exit-on-failure=false
#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# listen-address = Host/address to listen for XDMCP connections (use all addresses if not present)
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn. Alternatively
# it can be a word and the first 7 characters are used as the key.
#
[XDMCPServer]
#enabled=false
#port=177
#listen-address=
#key=
#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# command = Command to run Xvnc server with
# port = TCP/IP port to listen for connections on
# listen-address = Host/address to listen for VNC connections (use all addresses if not present)
# width = Width of display to use
# height = Height of display to use
# depth = Color depth of display to use
#
[VNCServer]
#enabled=false
#command=Xvnc
#port=5900
#listen-address=
#width=1024
#height=768
#depth=8

View file

@ -0,0 +1,35 @@
URxvt*font: xft:Inconsolata:size=11
URxvt*geometry: 128x32+24+24
URxvt*scrollBar_right: True
URxvt*scrollstyle: plain
URxvt*shading: 30
URxvt*transparent: true
! Base16 Isotope
! Scheme: Jan T. Sott
!! Modified by 2Shirt
*.foreground: #d0d0d0
*.background: #000000
*.cursorColor: #d0d0d0
*.color0: #000000
*.color1: #ff0000
*.color2: #33ff00
*.color3: #ffd000
*.color4: #0066ff
*.color5: #cc00ff
*.color6: #00ffff
*.color7: #d0d0d0
*.color8: #808080
*.color9: #ff9900
*.color10: #404040
*.color11: #606060
*.color12: #c0c0c0
*.color13: #e0e0e0
*.color14: #3300ff
*.color15: #ffffff

View file

@ -0,0 +1,3 @@
#
# ~/.bash_logout
#

View file

@ -0,0 +1,5 @@
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc

View file

@ -0,0 +1,9 @@
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

View file

@ -0,0 +1,12 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Conky
Comment=Conky
Exec=/home/wktech/.conky_start
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false

View file

@ -0,0 +1,12 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=urxvt-Resolution
Comment=urxvt-Resolution
Exec=/home/wktech/.urxvt_default_res
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false

View file

@ -0,0 +1,12 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=WiFi
Comment=WiFi
Exec=/home/wktech/.wifi
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false

View file

@ -1,2 +1,3 @@
WebBrowser=chromium
WebBrowser=midori
TerminalEmulator=urxvt

View file

@ -1,5 +1,5 @@
favorites=exo-file-manager.desktop,gparted.desktop,gsmartcontrol.desktop,truecrypt.desktop,exo-web-browser.desktop
recent=xfce4-settings-editor.desktop,xfce-session-settings.desktop,xfce-workspaces-settings.desktop,gsmartcontrol.desktop,gparted.desktop,gksu-properties.desktop,xfce-keyboard-settings.desktop,xfce-backdrop-settings.desktop,truecrypt.desktop,exo-web-browser.desktop
favorites=exo-file-manager.desktop,hwdiags.desktop,gparted.desktop,gsmartcontrol.desktop,truecrypt.desktop,speedtest.desktop,exo-web-browser.desktop
recent=exo-web-browser.desktop
button-title=Applications
button-icon=desktop-environment-xfce
button-single-row=false

View file

@ -7,7 +7,7 @@
<property name="workspace0" type="empty">
<property name="color-style" type="int" value="0"/>
<property name="image-style" type="int" value="5"/>
<property name="last-image" type="string" value="/home/wktech/Downloads/wallhaven-333506.png"/>
<property name="last-image" type="string" value="/usr/share/wallpaper/current.png"/>
</property>
<property name="workspace1" type="empty">
<property name="color-style" type="int" value="0"/>

View file

@ -46,7 +46,10 @@
<property name="&lt;Super&gt;f" type="string" value="exo-open --launch FileManager /home/wktech">
<property name="startup-notify" type="bool" value="true"/>
</property>
<property name="&lt;Super&gt;d" type="string" value="xfce4-terminal -T &quot;Hardware Diagnostics&quot; -H -I xcos -x hw-diags"/>
<property name="&lt;Super&gt;m" type="string" value="urxvt -title &quot;Mount all Volumes&quot; -e mount-all-volumes"/>
<property name="&lt;Super&gt;d" type="string" value="urxvt -title &quot;Hardware Diagnostics&quot; -e hw-diags"/>
<property name="&lt;Super&gt;s" type="string" value="urxvt -title &quot;Hardware Diagnostics - FoH&quot; -e hw-diags foh"/>
<property name="&lt;Primary&gt;Escape" type="string" value="xfce4-popup-whiskermenu"/>
</property>
</property>
<property name="xfwm4" type="empty">

View file

@ -13,8 +13,9 @@
<value type="int" value="18"/>
<value type="int" value="3"/>
<value type="int" value="15"/>
<value type="int" value="9"/>
<value type="int" value="1"/>
<value type="int" value="6"/>
<value type="int" value="4"/>
<value type="int" value="5"/>
</property>
<property name="background-style" type="uint" value="0"/>
@ -40,7 +41,13 @@
<value type="string" value="task manager"/>
</property>
</property>
<property name="plugin-9" type="string" value="cpugraph"/>
<property name="plugin-18" type="string" value="whiskermenu"/>
<property name="plugin-1" type="string" value="mixer">
<property name="sound-card" type="string" value="default"/>
<property name="track" type="string" value="Master"/>
<property name="command" type="string" value="xfce4-mixer"/>
<property name="enable-keyboard-shortcuts" type="bool" value="true"/>
</property>
<property name="plugin-4" type="string" value="power-manager-plugin"/>
</property>
</channel>

View file

@ -1,3 +1,3 @@
#!/bin/bash
sleep 2s && conky
sleep 3s && conky

View file

@ -152,10 +152,12 @@ Down: ${downspeed}${goto 115}Up:${alignr}${upspeed}
${alignc}S H O R T C U T K E Y S
${hr}
[Win] + d${alignr}HW Diagnostics
[Win] + f${alignr}File Manager
[Win] + h${alignr}Task Manager
[Win] + r${alignr}Run Dialog
[Win] + t${alignr}Terminal
[Win] + w${alignr}Web Browser
[Win] + x${alignr}Logout
[Super] + d${alignr}HW Diagnostics
[Super] + f${alignr}File Manager
[Super] + h${alignr}Task Manager
[Super] + m${alignr}Mount Volumes
[Super] + r${alignr}Run Dialog
[Super] + s${alignr}SMART Check
[Super] + t${alignr}Terminal
[Super] + w${alignr}Web Browser
[Super] + x${alignr}Logout

View file

@ -0,0 +1,3 @@
[Desktop]
Language=en_US.utf8
Session=xfce

View file

@ -0,0 +1 @@
set -g status off

View file

@ -0,0 +1,11 @@
#!/bin/bash
XWIDTH="$(xrandr 2>/dev/null | grep '*' | sed -r 's/^\s+([0-9]+)x.*/\1/')"
XHEIGHT="$(xrandr 2>/dev/null | grep '*' | sed -r 's/^\s+[0-9]+x([0-9]+).*/\1/')"
WIDTH="$(echo "${XWIDTH}*96/1024" | bc)"
HEIGHT="$(echo "${XHEIGHT}*32/768" | bc)"
sed -i -r "s/96x32/${WIDTH}x${HEIGHT}/" ~/.Xresources
xrdb -merge ~/.Xresources

View file

@ -0,0 +1,5 @@
#!/bin/bash
sleep 1s
nmcli dev wifi con "SomeWiFi" password "Abracadabra"

View file

@ -6,35 +6,15 @@ sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
@ -43,8 +23,5 @@ fi
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK
# Start Openbox
#exec openbox-session
# Start Xfce4
exec startxfce4

View file

@ -1 +0,0 @@
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

View file

@ -6,18 +6,19 @@ alias 7z5='7z a -t7z -mx=5'
alias 7z7='7z a -t7z -mx=7'
alias 7z9='7z a -t7z -mx=9'
alias du='du -sch --apparent-size'
alias fidentify="/usr/bin/fidentify-wip$(getconf LONG_BIT)"
alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias less='less -S'
alias mkdir='mkdir -p'
alias mount='sudo mount'
alias mv='mv -nv'
alias photorec='sudo photorec'
alias q='clear && ls -lh'
alias q1='clear && ls -1'
alias q1a='clear && ls -1A'
alias qa='clear && ls -lAh'
alias qs='clear && ls'
alias qsa='clear && ls -A'
alias photorec="sudo /usr/bin/photorec-wip$(getconf LONG_BIT)"
alias q1='clear && sudo ls -1'
alias q1a='clear && sudo ls -1A'
alias q='clear && sudo ls -lh'
alias qa='clear && sudo ls -lAh'
alias qs='clear && sudo ls'
alias qsa='clear && sudo ls -A'
alias rm='rm -v'
alias rmdirs='find -depth -mindepth 1 -type d -exec rmdir "{}" --ignore-fail-on-non-empty \;'
alias rs='rsync -avhPS --stats --exclude-from="$HOME/.rsync_exclusions"'
@ -26,6 +27,6 @@ alias sdu='sudo du -sch --apparent-size'
alias srmdirs='find -depth -mindepth 1 -type d -exec sudo rmdir "{}" --ignore-fail-on-non-empty \;'
alias srs='sudo rsync -avhPS --stats --exclude-from="$HOME/.rsync_exclusions"'
alias srsz='sudo rsync -avhzPS --stats --exclude-from="$HOME/.rsync_exclusions"'
alias testdisk='sudo testdisk'
alias testdisk="sudo /usr/bin/testdisk-wip$(getconf LONG_BIT)"
alias umount='sudo umount'
alias unmount='sudo umount'

View file

@ -15,7 +15,7 @@ ZSH_THEME="lean"
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/NetworkManager.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/NetworkManager-dispatcher.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/lightdm.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/getty@.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/NetworkManager.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/remote-fs.target

View file

@ -0,0 +1,336 @@
##############################################################################
#
# udevil configuration file /etc/udevil/udevil.conf
#
# This file controls what devices, networks, and files users may mount and
# unmount via udevil (set suid).
#
# IMPORTANT: IT IS POSSIBLE TO CREATE SERIOUS SECURITY PROBLEMS IF THIS FILE
# IS MISCONFIGURED - EDIT WITH CARE
#
# Note: For greater control for specific users, including root, copy this
# file to /etc/udevil/udevil-user-USERNAME.conf replacing USERNAME with the
# desired username (eg /etc/udevil/udevil-user-jim.conf).
#
# Format:
# OPTION = VALUE[, VALUE, ...]
#
# DO NOT USE QUOTES except literally
# Lines beginning with # are ignored
#
##############################################################################
# To log all uses of udevil, set log_file to a file path:
# log_file = /var/log/udevil.log
# Approximate number of days to retain log entries (0=forever, max=60):
log_keep_days = 10
# allowed_types determines what fstypes can be passed by a user to the u/mount
# program, what device filesystems may be un/mounted implicitly, and what
# network filesystems may be un/mounted.
# It may also include the 'file' keyword, indicating that the user is allowed
# to mount files (eg an ISO file). The $KNOWN_FILESYSTEMS variable may
# be included to include common local filesystems as well as those listed in
# /etc/filesystems and /proc/filesystems.
# allowed_types_USERNAME, if present, is used to override allowed_types for
# the specific user 'USERNAME'. For example, to allow user 'jim' to mount
# only vfat filesystems, add:
# allowed_types_jim = vfat
# Setting allowed_types = * does NOT allow all types, as this is a security
# risk, but does allow all recognized types.
# allowed_types = $KNOWN_FILESYSTEMS, file, cifs, smbfs, nfs, curlftpfs, ftpfs, sshfs, davfs, tmpfs, ramfs
allowed_types = $KNOWN_FILESYSTEMS, file, cifs, smbfs, nfs, hfsplus
# allowed_users is a list of users permitted to mount and unmount with udevil.
# Wildcards (* or ?) may be used in the usernames. To allow all users,
# specify "allowed_users=*". UIDs may be included using the form UID=1000.
# For example: allowed_users = carl, UID=1000, pre*
# Also note that permission to execute udevil may be limited to users belonging
# to the group that owns /usr/bin/udevil, such as 'plugdev' or 'storage',
# depending on installation.
# allowed_users_FSTYPE, if present, is used to override allowed_users when
# mounting or unmounting a specific fstype (eg nfs, ext3, file).
# Note that when mounting a file, fstype will always be 'file' regardless of
# the internal fstype of the file.
# For example, to allow only user 'bob' to mount nfs shares, add:
# allowed_users_nfs = bob
# The root user is NOT automatically allowed to use udevil in some cases unless
# listed here (except for unmounting anything or mounting fstab devices).
allowed_users = *
# allowed_groups is a list of groups permitted to mount and unmount with
# udevil. The user MUST belong to at least one of these groups. Wildcards
# or GIDs may NOT be used in group names, but a single * may be used to allow
# all groups.
# Also note that permission to execute udevil may be limited to users belonging
# to the group that owns /usr/bin/udevil, such as 'plugdev' or 'storage',
# depending on installation.
# allowed_groups_FSTYPE, if present, is used to override allowed_groups when
# mounting or unmounting a specific fstype (eg nfs, ext3, file). For example,
# to allow only members of the 'network' group to mount smb and nfs shares,
# use both of these lines:
# allowed_groups_smbfs = network
# allowed_groups_nfs = network
# The root user is NOT automatically allowed to use udevil in some cases unless
# listed here (except for unmounting anything or mounting fstab devices).
allowed_groups = *
# allowed_media_dirs specifies the media directories in which user mount points
# may be located. The first directory which exists and does not contain a
# wildcard will be used as the default media directory (normally /media or
# /media/$USER).
# The $USER variable, if included, will be replaced with the username of the
# user running udevil. Wildcards may also be used in any directory EXCEPT the
# default. Wildcards will not match a /, except a /** suffix for recursion.
# allowed_media_dirs_FSTYPE, if present, is used to override allowed_media_dirs
# when mounting or unmounting a specific fstype (eg ext2, nfs). For example,
# to cause /media/network to be used as the default media directory for
# nfs and ftpfs mounts, use these two lines:
# allowed_media_dirs_nfs = /media/network, /media, /media/$USER
# allowed_media_dirs_ftpfs = /media/network, /media, /media/$USER
# NOTE: If you want only the user who mounted a device to have access to it
# and be allowed to unmount it, specify /media/$USER as the first
# allowed media directory (only /media/$USER is created on demand).
# IMPORTANT: If an allowed file is mounted to a media directory, the user may
# be permitted to unmount its associated loop device even though internal.
# INCLUDING /MNT HERE IS NOT RECOMMENDED. ALL ALLOWED MEDIA DIRECTORIES
# SHOULD BE OWNED AND WRITABLE ONLY BY ROOT.
allowed_media_dirs = /media, /media/$USER, /run/media/$USER
# allowed_devices is the first criteria for what block devices users may mount
# or unmount. If a device is not listed in allowed_devices, it cannot be
# un/mounted (unless in fstab). However, even if a device is listed, other
# factors may prevent its use. For example, access to system internal devices
# will be denied to normal users even if they are included in allowed_devices.
# allowed_devices_FSTYPE, if present, is used to override allowed_devices when
# mounting or unmounting a specific fstype (eg ext3, ntfs). For example, to
# prevent all block devices containing an ext4 filesystem from being
# un/mounted use:
# allowed_devices_ext4 =
# Note: Wildcards may be used, but a wildcard will never match a /, except
# for "allowed_devices=*" which allows any device. The recommended setting is
# allowed_devices = /dev/*
# WARNING: ALLOWING USERS TO MOUNT DEVICES OUTSIDE OF /dev CAN CAUSE SERIOUS
# SECURITY PROBLEMS. DO NOT ALLOW DEVICES IN /dev/shm
allowed_devices = /dev/*
# allowed_internal_devices causes udevil to treat any listed block devices as
# removable, thus allowing normal users to un/mount them (providing they are
# also listed in allowed_devices).
# allowed_internal_devices_FSTYPE, if present, is used to override
# allowed_internal_devices when mounting or unmounting a specific fstype
# (eg ext3, ntfs). For example, to allow block devices containing a vfat
# filesystem to be un/mounted even if they are system internal devices, use:
# allowed_internal_devices_vfat = /dev/sdb*
# Some removable esata drives look like internal drives to udevil. To avoid
# this problem, they can be treated as removable with this setting.
# WARNING: SETTING A SYSTEM DEVICE HERE CAN CAUSE SERIOUS SECURITY PROBLEMS.
allowed_internal_devices = /dev/*
# allowed_internal_uuids and allowed_internal_uuids_FSTYPE work similarly to
# allowed_internal_devices, except that UUIDs are specified instead of devices.
# For example, to allow un/mounting of an internal filesystem based on UUID:
# allowed_internal_uuids = cc0c4489-8def-1e5b-a304-ab87c3cb626c0
# WARNING: SETTING A SYSTEM DEVICE HERE CAN CAUSE SERIOUS SECURITY PROBLEMS.
# allowed_internal_uuids =
# forbidden_devices is used to prevent block devices from being un/mounted
# even if other settings would allow them (except devices in fstab).
# forbidden_devices_FSTYPE, if present, is used to override
# forbidden_devices when mounting or unmounting a specific fstype
# (eg ext3, ntfs). For example, to prevent device /dev/sdd1 from being
# mounted when it contains an ntfs filesystem, use:
# forbidden_devices_ntfs = /dev/sdd1
# NOTE: device node paths are canonicalized before being tested, so forbidding
# a link to a device will have no effect.
forbidden_devices =
# allowed_networks determines what hosts may be un/mounted by udevil users when
# using nfs, cifs, smbfs, curlftpfs, ftpfs, or sshfs. Hosts may be specified
# using a hostname (eg myserver.com) or IP address (192.168.1.100).
# Wildcards may be used in hostnames and IP addresses, but CIDR notation
# (192.168.1.0/16) is NOT supported. IP v6 is supported. For example:
# allowed_networks = 127.0.0.1, 192.168.1.*, 10.0.0.*, localmachine, *.okay.com
# Or, to prevent un/mounting of any network shares, set:
# allowed_networks =
# allowed_networks_FSTYPE, if present, is used to override allowed_networks
# when mounting or unmounting a specific network fstype (eg nfs, cifs, sshfs,
# curlftpfs). For example, to limit nfs and samba shares to only local
# networks, use these two lines:
# allowed_networks_nfs = 192.168.1.*, 10.0.0.*
# allowed_networks_cifs = 192.168.1.*, 10.0.0.*
allowed_networks = *
# forbidden_networks and forbidden_networks_FSTYPE are used to specify networks
# that are never allowed, even if other settings allow them (except fstab).
# NO REVERSE LOOKUP IS PERFORMED, so including bad.com will only have an effect
# if the user uses that hostname. IP lookup is always performed, so forbidding
# an IP address will also forbid all corresponding hostnames.
forbidden_networks =
# allowed_files is used to determine what files in what directories may be
# un/mounted. A user must also have read permission on a file to mount it.
# Note: Wildcards may be used, but a wildcard will never match a /, except
# for "allowed_files=*" which allows any file, and a /** suffix, which matches
# all files recursively.
# For example, to allow only files in the /share directory to be mounted, use:
# allowed_files = /share/*
# To allow all files in the /share directory AND all subdirectories use:
# allowed_files = /share/**
# NOTE: Specifying allowed_files_FSTYPE will NOT work because the fstype of
# files is always 'file'.
allowed_files = *
# forbidden_files is used to specify files that are never allowed, even if
# other settings allow them (except fstab). Specify a full path.
# Note: Wildcards may be used, but a wildcard will never match a /, except
# for "forbidden_files = *", or a /** suffix, which matches all recursively.
# NOTE: file paths are canonicalized before being tested, so forbidding
# a link to a file will have no effect.
forbidden_files =
# default_options specifies what options are always included when performing
# a mount, in addition to any options the user may specify.
# Note: When a device is present in /etc/fstab, and the user does not specify
# a mount point, the device is mounted with normal user permissions using
# the fstab entry, without these options.
# default_options_FSTYPE, if present, is used to override default_options
# when mounting a specific fstype (eg ext2, nfs).
# The variables $USER, $UID, and $GID are changed to the user's username, UID,
# and GID.
# FOR GOOD SECURITY, default_options SHOULD ALWAYS INCLUDE: nosuid,noexec,nodev
# WARNING: OPTIONS PRESENT OR MISSING CAN CAUSE SERIOUS SECURITY PROBLEMS.
default_options = nosuid, noexec, nodev, noatime
default_options_file = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, ro
# mount iso9660 with 'ro' to prevent mount read-only warning
default_options_iso9660 = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, ro, utf8
default_options_udf = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_vfat = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID, utf8
default_options_exfat = nosuid, noexec, nodev, noatime, umask=0077, uid=$UID, gid=$GID, iocharset=utf8, namecase=0, nonempty
default_options_hfsplus = nosuid, noexec, nodev, ro, uid=$UID, gid=$GID
default_options_msdos = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID
default_options_umsdos = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID
default_options_ntfs = nosuid, noexec, nodev, noatime, fmask=0133, uid=$UID, gid=$GID, utf8
default_options_cifs = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_smbfs = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_sshfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, nonempty, allow_other
default_options_curlftpfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, nonempty, allow_other
default_options_ftpfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_davfs = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_tmpfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_ramfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
# allowed_options determines all options that a user may specify when mounting.
# All the options used in default_options above must be included here too, or
# they will be rejected. If the user attempts to use an option not included
# here, an error will result. Wildcards may be used.
# allowed_options_FSTYPE, if present, is used to override allowed_options
# when mounting a specific fstype (eg ext2, nfs).
# The variables $USER, $UID, and $GID are changed to the user's username, UID,
# and GID.
# If you want to forbid remounts, remove 'remount' from here.
# WARNING: OPTIONS HERE CAN CAUSE SERIOUS SECURITY PROBLEMS - CHOOSE CAREFULLY
allowed_options = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID, ro, rw, sync, flush, iocharset=*, utf8, remount
allowed_options_nfs = nosuid, noexec, nodev, noatime, ro, rw, sync, remount, port=*, rsize=*, wsize=*, hard, proto=*, timeo=*, retrans=*
allowed_options_cifs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=*
allowed_options_smbfs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=*
allowed_options_sshfs = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, idmap=user, BatchMode=yes, port=*
allowed_options_curlftpfs = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, user=*
allowed_options_ftpfs = nosuid, noexec, nodev, noatime, ro, rw, port=*, user=*, pass=*, root=*, uid=$UID, gid=$GID
allowed_options_exfat = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID, umask=0077, namecase=*, ro, rw, sync, flush, iocharset=*, remount, nonempty
# mount_point_mode, if present and set to a non-empty value, will cause udevil
# to set the mode (permissions) on the moint point after mounting If not
# specified or if left empty, the mode is not changed. Mode must be octal
# starting with a zero (0755).
# mount_point_mode_FSTYPE, if present, is used to override mount_point_mode
# when mounting a specific fstype (eg ext2, nfs).
# NOT SETTING A MODE CAN HAVE SECURITY IMPLICATIONS FOR SOME FSTYPES
mount_point_mode = 0755
# don't set a mode for some types:
mount_point_mode_sshfs =
mount_point_mode_curlftpfs =
mount_point_mode_ftpfs =
# Use the settings below to change the default locations of programs used by
# udevil, or (advanced topic) to redirect commands to your scripts.
# When substituting scripts, make sure they are root-owned and accept the
# options used by udevil (for example, the mount_program must accept --fake,
# -o, -v, and other options valid to mount.)
# Be sure to specify the full path and include NO OPTIONS or other arguments.
# These programs may also be specified as configure options when building
# udevil.
# THESE PROGRAMS ARE RUN AS ROOT
# mount_program = /bin/mount
# umount_program = /bin/umount
# losetup_program = /sbin/losetup
# setfacl_program = /usr/bin/setfacl
# validate_exec specifies a program or script which provides additional
# validation of a mount or unmount command, beyond the checks performed by
# udevil. The program is run as a normal user (if root runs udevil,
# validate_exec will NOT be run). The program is NOT run if the user is
# mounting a device without root priviledges (a device in fstab).
# The program is passed the username, a printable description of what is
# happening, and the entire udevil command line as the first three arguments.
# The program must return an exit status of 0 to allow the mount or unmount
# to proceed. If it returns non-zero, the user will be denied permission.
# For example, validate_exec might specify a script which notifies you
# of the command being run, or performs additional steps to authenticate the
# user.
# Specify a full path to the program, with NO options or arguments.
# validate_exec =
# validate_rootexec works similarly to validate_exec, except that the program
# is run as root. validate_rootexec will also be run if the root user runs
# udevil. If both validate_exec and validate_rootexec are specified,
# validate_rootexec will run first, followed by validate_exec.
# The program must return an exit status of 0 to allow the mount or unmount
# to proceed. If it returns non-zero, the user will be denied permission.
# Unless you are familiar with writing root scripts, it is recommended that
# rootexec settings NOT be used, as it is easy to inadvertently open exploits.
# THIS PROGRAM IS ALWAYS RUN AS ROOT, even if the user running udevil is not.
# validate_rootexec =
# success_exec is run after a successful mount, remount, or unmount. The
# program is run as a normal user (if root runs udevil, success_exec
# will NOT be run).
# The program is passed the username, a printable description of what action
# was taken, and the entire udevil command line as the first three arguments.
# The program's exit status is ignored.
# For example, success_exec might run a script which informs you of what action
# was taken, and might perform further actions.
# Specify a full path to the program, with NO options or arguments.
# success_exec =
# success_rootexec works similarly to success_exec, except that the program is
# run as root. success_rootexec will also be run if the root user runs udevil.
# If both success_exec and success_rootexec are specified, success_rootexec
# will run first, followed by success_exec.
# Unless you are familiar with writing root scripts, it is recommended that
# rootexec settings NOT be used, as it is easy to inadvertently open exploits.
# THIS PROGRAM IS ALWAYS RUN AS ROOT, even if the user running udevil is not.
# success_rootexec =

View file

@ -14,18 +14,18 @@ ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
# root user settings
usermod -s /usr/bin/zsh root
cp -aT /etc/skel/ /root/
rm /root/.zlogin
chmod 700 /root
echo "root:Abracadabra" | chpasswd
# Add autologin group
groupadd -r autologin
# Add wktech user
useradd -m -s /bin/zsh -G wheel -U wktech
useradd -m -s /bin/zsh -G autologin,storage,wheel -U wktech
echo "wktech:Abracadabra" | chpasswd
# Enable sudo for %wheel
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers
# Enable firewall
ufw enable
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Set pacman mirrorlist
echo 'Server = http://arch.localmsp.org/arch/$repo/os/$arch' > /etc/pacman.d/mirrorlist
@ -44,5 +44,5 @@ sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf
# Startup settings (from archiso)
systemctl enable pacman-init.service choose-mirror.service
systemctl enable NetworkManager.service
systemctl set-default multi-user.target
#systemctl set-default multi-user.target
systemctl set-default graphical.target

View file

@ -0,0 +1,86 @@
#!/bin/bash
#
## WK HW diagnostics - Launcher
MODE="$1"
# Ensure a proper mode is selected
while :; do
if [[ "$MODE" =~ ^(all|cpu|drives|foh|smart|badblocks)$ ]]; then
break
else
clear
echo "Hardware Diagnostics"
echo "────────────────────"
echo "0: Quick drive test"
echo "1: All tests"
echo "2: Prime95"
echo "3: SMART & badblocks"
echo "4: SMART"
echo "5: badblocks"
echo "────────────────────"
if [[ -n $DISPLAY ]]; then
echo "6: Graphics Test - FurMark"
echo "7: Graphics Test - Piano"
echo "8: Graphics Test - Volplosion"
fi
echo "A: Speaker Test"
if [[ -n $DISPLAY ]]; then
echo "K: Keyboard Test"
fi
echo "────────────────────"
echo ""
echo "Q: Quit"
echo ""
read -r -p "Please make a selection: " MODE
# Check input
case $MODE in
0)
MODE=foh
break;;
1)
MODE=all
break;;
2)
MODE=cpu
break;;
3)
MODE=drives
break;;
4)
MODE=smart
break;;
5)
MODE=badblocks
break;;
6)
if [[ -n $DISPLAY ]]; then
gputest /fullscreen /test=fur
fi
;;
7)
if [[ -n $DISPLAY ]]; then
gputest /fullscreen /test=pixmark_piano
fi
;;
8)
if [[ -n $DISPLAY ]]; then
gputest /fullscreen /test=pixmark_volplosion
fi
;;
a|A|audio|Audio)
hw-diags-audio;;
k|K|keyboard|Keyboard)
if [[ -n $DISPLAY ]]; then
xev
fi
;;
q|Q|quit|Quit)
exit 1;;
esac
fi
done
# Start tmux
tmux new-session -s 'hw-session' -n 'hw-window' "hw-diags-inner $MODE"

View file

@ -0,0 +1,11 @@
#!/bin/bash
#
## WK HW diagnostics - Audio (Stereo)
# Unmute and set volume
amixer -q set "Master" 80% unmute
amixer -q set "PCM" 90% unmute
speaker-test -c 2 -l 1 -t pink
# speaker-test -c 2 -l 1 -t sine
speaker-test -c 2 -l 1 -t wav

View file

@ -0,0 +1,25 @@
#!/bin/bash
#
## WK HW diagnostics - badblocks
function usage {
echo "Usage: $0 log-dir device"
echo " e.g. $0 /var/tmp/hw-diags/9001 /dev/sda"
}
# Bail early
if [ ! -d "$1" ]; then
usage
exit 1
fi
if [ ! -b "$2" ]; then
usage
exit 1
fi
# Run Badblocks
sudo badblocks -sv -e 1 "$2"
tmux capture-pane
tmux save-buffer "$1/bb_tmp.out"
grep -Ev '^$' "$1/bb_tmp.out" > "$1/${2##*/}_badblocks.log"
rm "$1/bb_tmp.out"

View file

@ -0,0 +1,483 @@
#!/bin/bash
#
## WK HW Diagnostics - Main script
# Setup tmux
# tmux set remain-on-exit on
tmux set status off
# Get TICKET#
TICKET=""
while [[ "$TICKET" == "" ]]; do
if [[ "$1" == "foh" ]]; then
TICKET="foh-consult"
else
echo -n "Please enter the Service Order #: "
read -r _ticket
if echo "$_ticket" | grep -Eq '^[0-9]+\S*$'; then
TICKET="$_ticket"
fi
fi
done
# Init
DIAG_DATE="$(date "+%F_%H%M")"
DIAG_SERVER_AVAIL="False"
DIAG_SERVER="10.0.0.10"
DIAG_DEST="/srv/Diagnostics/${TICKET}/${DIAG_DATE}"
DIAG_USER="wkdiag"
TMP_DIR="/var/tmp/hw-diags/${TICKET}/${DIAG_DATE}"
ERRORS="False"
ERROR_IMG="$TMP_DIR/error.jpg"
PASSED_IMG="$TMP_DIR/passed.jpg"
TEST_CPU="False"
TEST_OVER="False"
TEST_SMART="False"
TEST_BADBLOCKS="False"
SKIP_SHORT_TEST="False"
LOG="$TMP_DIR/hw-diags.log"
OUT="$TMP_DIR/hw-diags.out"
# Get list of drives to test (excluding any ARCH drives)
## Some code borrowed from stackoverflow.com/a/10020397
ARCH_DRIVES=($(ls -l /dev/disk/by-label | grep -iE 'ARCH.*[hs]d[a-z]' | sed -r 's#.*/([hs]d[a-z])[0-9]+#\1#' | sort | uniq))
DRIVES=($(inxi -Dxx -c 0 | grep -E "ID-[0-9]+" | sed -r 's#.*/dev/([hs]d[a-z]).*#\1#' | sort))
for d in "${ARCH_DRIVES[@]}"; do
DRIVES=(${DRIVES[@]//*$d*})
done
# Test connection to DIAG_SERVER
if ip a | grep -q '192.168.1' && \
ping -c 1 -q $DIAG_SERVER >/dev/null 2>&1; then
DIAG_SERVER_AVAIL="True"
ssh $DIAG_USER@$DIAG_SERVER mkdir -p "$DIAG_DEST"
fi
# Setup Env
mkdir "$TMP_DIR" -p 2>/dev/null
pushd "$TMP_DIR" >/dev/null
touch "$OUT"
rm local.txt results.txt 2>/dev/null
# Functions
CLEAR="\e[0m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
function update_progress {
echo "HW Diagnostics" > "$LOG"
echo "${BLUE}HW Diagnostics${CLEAR}" > "$OUT"
echo "───────────────" >> "$LOG"
echo "───────────────" >> "$OUT"
if [[ "$TEST_CPU" == "True" ]]; then
echo "" >> "$LOG"
echo "" >> "$OUT"
if [[ "$cpu_result" == "CS" ]]; then
echo "Prime95 CS" >> "$LOG"
echo "${BLUE}Prime95${CLEAR} ${GREEN}CS${CLEAR}" >> "$OUT"
elif [[ "$cpu_result" == "Working" ]]; then
echo "Prime95 Working" >> "$LOG"
echo "${BLUE}Prime95${CLEAR} ${YELLOW}Working${CLEAR}" >> "$OUT"
elif [[ "$cpu_result" == "Unknown" ]]; then
echo "Prime95 Unknown" >> "$LOG"
echo "${BLUE}Prime95${CLEAR} ${YELLOW}Unknown${CLEAR}" >> "$OUT"
else
echo "Prime95 NS" >> "$LOG"
echo "${BLUE}Prime95${CLEAR} ${RED}NS${CLEAR}" >> "$OUT"
fi
fi
if [[ "$TEST_SMART" == "True" ]]; then
echo "" >> "$LOG"
echo "" >> "$OUT"
if [[ "$SKIP_SHORT_TEST" == "True" ]]; then
echo "SMART (Quick)" >> "$LOG"
echo "${BLUE}SMART${CLEAR} ${YELLOW}(Quick)${CLEAR}" >> "$OUT"
else
echo "SMART" >> "$LOG"
echo "${BLUE}SMART${CLEAR}" >> "$OUT"
fi
for d in "${DRIVES[@]}"; do
d_tmp="${d##*/}_smart_result"
eval "d_tmp=\$$d_tmp"
if [[ "$d_tmp" == "CS" ]]; then
echo "${d##*/} CS" >> "$LOG"
echo "${d##*/} ${GREEN}CS${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "Working" ]]; then
echo "${d##*/} Working" >> "$LOG"
echo "${d##*/} ${YELLOW}Working${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "Unknown" ]]; then
echo "${d##*/} Unknown" >> "$LOG"
echo "${d##*/} ${YELLOW}Unknown${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "NS" ]]; then
echo "${d##*/} NS" >> "$LOG"
echo "${d##*/} ${RED}NS${CLEAR}" >> "$OUT"
else
echo "${d##*/}" >> "$LOG"
echo "${d##*/}" >> "$OUT"
fi
done
fi
if [[ "$TEST_BADBLOCKS" == "True" ]]; then
echo "" >> "$LOG"
echo "" >> "$OUT"
echo "Badblocks" >> "$LOG"
echo "${BLUE}Badblocks${CLEAR}" >> "$OUT"
for d in "${DRIVES[@]}"; do
d_tmp="${d##*/}_badblocks_result"
eval "d_tmp=\$$d_tmp"
if [[ "$d_tmp" == "CS" ]]; then
echo "${d##*/} CS" >> "$LOG"
echo "${d##*/} ${GREEN}CS${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "Working" ]]; then
echo "${d##*/} Working" >> "$LOG"
echo "${d##*/} ${YELLOW}Working${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "Skipped" ]]; then
echo "${d##*/} Skipped" >> "$LOG"
echo "${d##*/} ${RED}Skipped${CLEAR}" >> "$OUT"
elif [[ "$d_tmp" == "NS" ]]; then
echo "${d##*/} NS" >> "$LOG"
echo "${d##*/} ${RED}NS${CLEAR}" >> "$OUT"
else
echo "${d##*/}" >> "$LOG"
echo "${d##*/}" >> "$OUT"
fi
done
fi
if [[ "$TEST_OVER" == "True" ]]; then
echo "" >> "$LOG"
echo "" >> "$OUT"
echo "───────────────" >> "$LOG"
echo "───────────────" >> "$OUT"
if [[ "$ERRORS" == "True" ]]; then
echo "HW: Error(s)" >> "$LOG"
echo "${RED}HW: Error(s)${CLEAR}" >> "$OUT"
else
echo "HW: Passed" >> "$LOG"
echo "${GREEN}HW: Passed${CLEAR}" >> "$OUT"
fi
fi
# Update Server
if [[ "$DIAG_SERVER_AVAIL" == "True" ]]; then
rsync -aqz "$TMP_DIR/" $DIAG_USER@$DIAG_SERVER:"$DIAG_DEST/" --exclude '*.out'
fi
}
# Select Tests
case "$1" in
all)
TEST_CPU="True"
TEST_SMART="True"
TEST_BADBLOCKS="True"
;;
cpu)
TEST_CPU="True"
TEST_SMART="False"
TEST_BADBLOCKS="False"
;;
drives)
TEST_CPU="False"
TEST_SMART="True"
TEST_BADBLOCKS="True"
;;
foh)
TEST_CPU="False"
TEST_SMART="True"
TEST_BADBLOCKS="False"
SKIP_SHORT_TEST="True"
;;
smart)
TEST_CPU="False"
TEST_SMART="True"
TEST_BADBLOCKS="False"
;;
badblocks)
TEST_CPU="False"
TEST_SMART="False"
TEST_BADBLOCKS="True"
;;
esac
if [[ "$TEST_CPU" == "False" ]] && \
[[ "$TEST_SMART" == "False" ]] && \
[[ "$TEST_BADBLOCKS" == "False" ]]; then
echo -e "${YELLOW}Aborting HW diagnostics${CLEAR}"
exit 1
fi
# Configure display
tmux split-window -d -h -l 16 "hw-diags-progress $OUT"
update_progress
# CPU
if [[ "$TEST_CPU" == "True" ]]; then
clear
CPU_ERRORS="False"
cpu_result="Working"
update_progress
(sleep 10m && killall -s INT "mprime$(getconf LONG_BIT)" >>/dev/null 2>&1) &
(sleep 10m && killall "hw-diags-sensors" >>/dev/null 2>&1) &
tmux split-window -d -v -l 10 "hw-diags-prime95 $TMP_DIR"
hw-diags-sensors "$TMP_DIR" 2>/dev/null
sleep 1s
# tmux kill-pane -t 1
if [[ -f "results.txt" ]]; then
mv -nv results.txt "prime-results.txt"
if grep -q -iE '(error|fail)' "prime-results.txt"; then
cpu_result="NS"
CPU_ERRORS="True"
else
cpu_result="CS"
fi
elif [[ -f "prime.log" ]]; then
if grep -i 'completed' "prime.log" | grep -q -iv '0 errors, 0 warnings'; then
cpu_result="NS"
CPU_ERRORS="True"
else
cpu_result="CS"
fi
else
CPU_ERRORS="True"
cpu_result="Unknown"
fi
update_progress
if [[ "$CPU_ERRORS" == "True" ]]; then
ERRORS="True"
fi
fi
# SMART
if [[ "$TEST_SMART" == "True" ]]; then
clear
SMART_ERRORS="False"
echo "Checking SMART status..."
for d in "${DRIVES[@]}"; do
tmp_device="${d##*/}"
eval "${tmp_device}_smart_result=Working"
inxi -Dxx | grep "/dev/${tmp_device}" | sed -r "s#.*/dev/${tmp_device} (.*)# \1#" > "${tmp_device}_report.out"
inxi -Dxxc 0 | grep "/dev/${tmp_device}" | sed -r "s#.*/dev/${tmp_device} (.*)# \1#" > "${tmp_device}_report.log"
update_progress
# Attempt to enable SMART reporting
if sudo smartctl -s on "/dev/${tmp_device}" | grep -q 'device lacks SMART capability'; then
SMART_ERRORS="True"
eval "${tmp_device}_smart_result=Unknown"
echo " ${RED}ERROR: device lacks SMART capability${CLEAR}" >> "${tmp_device}_report.out"
echo " ERROR: device lacks SMART capability" >> "${tmp_device}_report.log"
sleep 1s
fi
# Save current SMART values
sudo smartctl --all "/dev/${tmp_device}" >> "${tmp_device}-smart.log"
sudo smartctl -l error "/dev/${tmp_device}" >> "${tmp_device}-smart-err.log"
# Check specific SMART results
sudo smartctl -A "/dev/${tmp_device}" | grep -E '^\s*(5|9|184|197|198)\s' >> "${tmp_device}-smart-attributes.log"
# 5 - Reallocated Sectors
if grep -qE '^\s*5\s' "${tmp_device}-smart-attributes.log"; then
line="$(grep -E '^\s*5\s' "${tmp_device}-smart-attributes.log")"
value=$(echo "$line" | sed -r 's/.*\s([0-9]+).*/\1/')
echo " Reallocated Sectors: $value" >> "${tmp_device}_report.log"
if [[ "$value" -gt 0 ]]; then
SMART_ERRORS="True"
echo " ${RED}Reallocated Sectors: $value${CLEAR}" >> "${tmp_device}_report.out"
else
echo " ${GREEN}Reallocated Sectors: $value${CLEAR}" >> "${tmp_device}_report.out"
fi
fi
# 9 - Power-on Hours (Warn, but don't prevent badblock scan)
if grep -qE '^\s*9\s' "${tmp_device}-smart-attributes.log"; then
line="$(grep -E '^\s*9\s' "${tmp_device}-smart-attributes.log")"
value=$(echo "$line" | sed -r 's/.*\s([0-9]+).*/\1/')
echo " Power-on Hours: $value" >> "${tmp_device}_report.log"
if [[ "$value" -gt 18000 ]]; then
#SMART_ERRORS="True"
echo " ${RED}Power-on Hours: $value (VERY OLD)${CLEAR}" >> "${tmp_device}_report.out"
elif [[ "$value" -gt 12000 ]]; then
echo " ${YELLOW}Power-on Hours: $value${CLEAR}" >> "${tmp_device}_report.out"
else
echo " ${GREEN}Power-on Hours: $value${CLEAR}" >> "${tmp_device}_report.out"
fi
fi
# 184 - End-to-End Errors
if grep -qE '^\s*184\s' "${tmp_device}-smart-attributes.log"; then
line="$(grep -E '^\s*184\s' "${tmp_device}-smart-attributes.log")"
value=$(echo "$line" | sed -r 's/.*\s([0-9]+).*/\1/')
echo " End-to-End Errors: $value" >> "${tmp_device}_report.log"
if [[ "$value" -gt 0 ]]; then
SMART_ERRORS="True"
echo " ${RED}End-to-End Errors: $value${CLEAR}" >> "${tmp_device}_report.out"
else
echo " ${GREEN}End-to-End Errors: $value${CLEAR}" >> "${tmp_device}_report.out"
fi
fi
# 197 - Current Pending Sectors
if grep -qE '^\s*197\s' "${tmp_device}-smart-attributes.log"; then
line="$(grep -E '^\s*197\s' "${tmp_device}-smart-attributes.log")"
value=$(echo "$line" | sed -r 's/.*\s([0-9]+).*/\1/')
echo " Current Pending Sectors: $value" >> "${tmp_device}_report.log"
if [[ "$value" -gt 0 ]]; then
SMART_ERRORS="True"
echo " ${RED}Current Pending Sectors: $value${CLEAR}" >> "${tmp_device}_report.out"
else
echo " ${GREEN}Current Pending Sectors: $value${CLEAR}" >> "${tmp_device}_report.out"
fi
fi
# 198 - Offline Uncorrectable
if grep -qE '^\s*198\s' "${tmp_device}-smart-attributes.log"; then
line="$(grep -E '^\s*198\s' "${tmp_device}-smart-attributes.log")"
value=$(echo "$line" | sed -r 's/.*\s([0-9]+).*/\1/')
echo " Offline Uncorrectable: $value" >> "${tmp_device}_report.log"
if [[ "$value" -gt 0 ]]; then
SMART_ERRORS="True"
echo " ${RED}Offline Uncorrectable: $value${CLEAR}" >> "${tmp_device}_report.out"
else
echo " ${GREEN}Offline Uncorrectable: $value${CLEAR}" >> "${tmp_device}_report.out"
fi
fi
if [[ "$SMART_ERRORS" == "False" ]] && [[ "$SKIP_SHORT_TEST" == "False" ]]; then
if sudo smartctl -c "/dev/${tmp_device}" >>/dev/null 2>&1; then
# Determine short-test polling time
wait_time=$(sudo smartctl -c "/dev/${tmp_device}" | grep -i 'polling time' | head -1 | sed -r 's/.*\( *([0-9]+)\).*/\1/')
wait_time=$(( wait_time + 5))
# Run short self-test
echo " Running SMART short self-test ($wait_time minutes)..."
sudo smartctl -t short "/dev/${tmp_device}" >/dev/null
sleep ${wait_time}m
sudo smartctl -l selftest "/dev/${tmp_device}" >> "${tmp_device}-smart-tests.log"
if grep '^#' "${tmp_device}-smart-tests.log" | head -1 | grep -iq 'completed without error'; then
echo " ${GREEN}Self-test: passed${CLEAR}" >> "${tmp_device}_report.out"
echo " Self-test: passed" >> "${tmp_device}_report.log"
else
echo " ${RED}Self-test: failed${CLEAR}" >> "${tmp_device}_report.out"
echo " Self-test: failed" >> "${tmp_device}_report.log"
SMART_ERRORS="True"
fi
else
echo " ${RED}ERROR: Unable to run SMART self-test.${CLEAR}" >> "${tmp_device}_report.out"
echo " ERROR: Unable to run SMART self-test." >> "${tmp_device}_report.log"
fi
fi
if [[ "$SMART_ERRORS" == "False" ]]; then
eval "${tmp_device}_smart_result=CS"
else
ERRORS="True"
tmp_if="${tmp_device}_smart_result"
eval "tmp_if=\$$tmp_if"
if [[ "$tmp_if" != "Unknown" ]]; then
eval "${tmp_device}_smart_result=NS"
fi
fi
update_progress
done
fi
# Badblocks
if [[ "$TEST_BADBLOCKS" == "True" ]]; then
clear
for d in "${DRIVES[@]}"; do
# Get SMART results
tmp_device="${d##*/}"
d_smart="${tmp_device}_smart_result"
eval "d_smart=\$$d_smart"
# Check SMART results
if [[ "$d_smart" == "NS" ]]; then
echo -e "${RED}Skipping drive: $tmp_device${CLEAR}"
eval "${tmp_device}_badblocks_result=Skipped"
else
eval "${tmp_device}_badblocks_result=Working"
update_progress
echo "Testing drive: ${tmp_device}"
# Split and run
tmux split-window -d -v -l 7 "hw-diags-badblocks $TMP_DIR /dev/${tmp_device}"
# Wait until done
sleep 2s
while pgrep -G 0 -U 0 -f "badblocks.*${tmp_device}" >/dev/null 2>&1; do
sleep 1s;
done
sleep 2s
# Check log
if grep -q '0/0/0 errors' "${tmp_device}_badblocks.log"; then
eval "${tmp_device}_badblocks_result=CS"
else
eval "${tmp_device}_badblocks_result=NS"
fi
update_progress
fi
done
fi
# Result Screen
TEST_OVER="True"
update_progress
clear
echo "─── RESULTS ───"
if [[ "$TEST_CPU" == "True" ]]; then
echo -e "${BLUE}CPU:${CLEAR}"
if [[ -f "results.txt" ]]; then
echo "results.txt"
if grep -q -iE '(error|fail)' "prime-results.txt"; then
echo -e "${RED}$(grep -q -iE '(error|fail)' "prime-results.txt" | sed -r 's/^/ /' | tail -4)${CLEAR}"
else
sed -r 's/^/ /' "prime-results.txt" 2>/dev/null | tail -4
fi
echo ""
fi
if [[ -f "prime.log" ]]; then
echo "prime.log"
if grep -i 'completed' "prime.log" | grep -q -iv '0 errors, 0 warnings'; then
echo -e "${RED}$(grep -i 'completed' "prime.log" | grep -iv '0 errors, 0 warnings' | sed -r 's/^/ /' | tail -4)${CLEAR}"
else
grep -i 'completed' "prime.log" | grep -i '0 errors, 0 warnings' | sed -r 's/^.*(Worker #[0-9]+).*(Torture.*)/ \1 \2/' | tail -4
fi
fi
fi
if [[ "$TEST_SMART" == "True" ]] || \
[[ "$TEST_BADBLOCKS" == "True" ]]; then
for d in "${DRIVES[@]}"; do
echo -e "${BLUE}Drive $d:${CLEAR}"
if [[ -f "${d##*/}_report.out" ]]; then
echo -e "$(cat "${d##*/}_report.out" 2>/dev/null)"
fi
if [[ -f "${d##*/}_badblocks.log" ]]; then
grep 'Pass completed, ' "${d##*/}_badblocks.log" 2>/dev/null | sed -r 's/^Pass completed, / /' 2>/dev/null
fi
echo ""
done
fi
# System info dump
sudo inxi -CDdGlMmNopRsc 0 | grep -Ev '(/dev/ram|No RAID devices|Display Server|multisession)' > "system_info.txt"
# Cleanup
mkdir "$HOME/Tickets/$TICKET" -p 2>/dev/null
rsync -aS "$TMP_DIR" "$HOME/Tickets/"
popd >/dev/null
cd "$HOME/Tickets" && tar czf "${TICKET}.tgz" "$TICKET"
# End
echo -n "Press Enter to exit..."
read -r
killall hw-diags-progress >>/dev/null 2>&1
exit 0

View file

@ -0,0 +1,20 @@
#!/bin/bash
#
## WK HW diagnostics - Prime95
# Find executable
MPRIME="/usr/bin/mprime$(getconf LONG_BIT)"
function usage {
echo "Usage: $0 log-dir"
echo " e.g. $0 /var/tmp/hw-diags/9001"
}
# Bail early
if [ ! -d "$1" ]; then
usage
exit 1
fi
# Run Prime95
$MPRIME -t | grep -iv --line-buffered 'stress.txt' | tee -a "$1/prime.log"

View file

@ -0,0 +1,10 @@
#!/bin/bash
#
## WK HW diagnostics - Progress
# Loop forever
while :; do
clear
echo -e "$(cat "$1")"
sleep 1s
done

View file

@ -0,0 +1,43 @@
#!/bin/bash
#
## WK HW diagnostics - Sensors
LOG_DIR="$1"
function usage {
echo "Usage: $0 log-dir"
echo " e.g. $0 /var/tmp/hw-diags/9001"
}
# Bail early
if [ ! -d "$LOG_DIR" ]; then
usage
exit 1
fi
# Run Sensor loop
if sensors >/dev/null 2>&1; then
while :; do
sensors -A | grep -E -i -v '(N/A|RPM|\d+\s+V\s+|^\s*$)' > "$LOG_DIR/sensors.out" 2>/dev/null
# Colorize
# Blue: All temps (superseeded by other colors below)
sed -i -r 's#(\+[0-9]+\.[0-9].C)#\\e[34m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Green >= 60* C
sed -i -r 's#(\+6[0-9]\.[0-9].C)#\\e[32m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Yellow >= 70* C
sed -i -r 's#(\+7[0-9]\.[0-9].C)#\\e[33m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Orange >= 80* C
sed -i -r 's#(\+(8[0-9]|9[0-4])\.[0-9].C)#\\e[31\;1m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Red >= 95* C
sed -i -r 's#(\+(9[5-9]|1[0-9][0-9])\.[0-9].C)#\\e[31m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Output data
clear
echo -e "$(cat "$LOG_DIR/sensors.out")"
sleep 1s
done
else
echo -e "\e[33mNo sensors found!\nPlease monitor temperatures manually\e[0m"
sleep 1h
fi

View file

@ -0,0 +1,14 @@
#!/bin/bash
#
## Mount all volumes read-only
echo "Mounting all volumes"
regex="/dev/((h|s)d[a-z]|md)[0-9]+"
for v in $(inxi -Do | grep -E "$regex" | sed -r "s#.*($regex).*#\1#"); do
echo -n " $v: "
if udevil mount -o ro $v >>/dev/null 2>&1; then
echo "Mounted."
else
echo "Failed to mount."
fi
done

View file

@ -0,0 +1,10 @@
#!/bin/bash
#
## Mount NAS backup shares
echo "Mounting NAS backup shares"
sudo mkdir /Backups/ServerOne
sudo mount //10.0.0.10/Backups /Backups/ServerOne -o username=backup,password=Abracadabra
sudo mkdir /Backups/ServerTwo
sudo mount //10.0.0.11/Backups /Backups/ServerTwo -o username=backup,password=Abracadabra

View file

@ -0,0 +1,30 @@
#!/bin/bash
IFS=$'\n'
for s in $*; do
REGEX="$s"
REGEX=$(echo "$REGEX" | sed -r 's/\s+/\\s\*/g')
# Word Doc
for d in *doc; do
if antiword "$d" | grep -iqsP "($REGEX)"; then
echo "Possible match: $d"
echo "$d" >> msword.tmp
fi
done
# Word Docx
for d in *docx; do
if unzip -p "$d" word/document.xml | grep -iqsP "($REGEX)"; then
echo "Possible match: $d"
echo "$d" >> msword.tmp
fi
done
done
# Cleanup results
if [[ -f msword.tmp ]]; then
sort -u msword.tmp >> msword-matches.txt
fi

View file

@ -3,7 +3,7 @@ Version=1.0
Type=Application
Name=Hardware Diagnostics
Comment=
Exec=xfce4-terminal -T "Hardware Diagnostics" -H -I xcos -x hw-diags
Exec=urxvt -title "Hardware Diagnostics" -hold -e hw-diags
Icon=xcos
Path=
Terminal=false

View file

@ -3,7 +3,7 @@ Version=1.0
Type=Application
Name=SpeedTest
Comment=
Exec=xfce4-terminal -T SpeedTest -H -I network-workgroup -x speedtest
Exec=urxvt -titile SpeedTest -hold -e speedtest
Icon=network-workgroup
Path=
Terminal=false

View file

@ -1,22 +1,30 @@
arch-install-scripts
alsa-utils
antiword
b43-fwcutter
btrfs-progs
chromium
chntpw
clonezilla
conky
crda
curl
darkhttpd
ddrescue
dhclient
dialog
dmidecode
dmraid
dnsmasq
dnsutils
dos2unix
dosfstools
elinks
ethtool
exfat-utils
f2fs-tools
ffmpeg
fsarchiver
git
gcc-libs
gnome-keyring
gnu-netcat
gparted
@ -25,14 +33,28 @@ grub
gsmartcontrol
gtk-engine-murrine
hdparm
hfsprogs
htop
inxi
ipw2100-fw
ipw2200-fw
iw
lftp
librsvg
lightdm
lightdm-gtk-greeter
linux-atm
lm_sensors
mc
mdadm
mediainfo
mesa
midori
mkvtoolnix-cli
mpv
mtools
mupdf
ncdu
network-manager-applet
networkmanager
nfs-utils
@ -51,10 +73,13 @@ parted
partimage
ppp
pptpclient
pygtk
python2
refind-efi
rfkill
rp-pppoe
rsync
rxvt-unicode
smartmontools
speedtest-cli
speedtouch
@ -62,10 +87,12 @@ sudo
tcpdump
terminus-font
testdisk
tk
tmux
truecrypt
ttf-inconsolata
ufw
udevil
udisks2
usb_modeswitch
vim
vpnc
@ -74,6 +101,7 @@ wireless_tools
wpa_actiond
wpa_supplicant
wvdial
xf86-input-synaptics
xf86-video-amdgpu
xf86-video-ati
xf86-video-intel
@ -84,6 +112,8 @@ xfce4-goodies
xl2tpd
xorg-server
xorg-server-utils
xorg-xdpyinfo
xorg-xev
xorg-xinit
zd1211-firmware
zsh