2016-08: Retroactive initial commit
This commit is contained in:
commit
2ae7bb017f
5 changed files with 157 additions and 0 deletions
118
.bin/Scripts/diagnostics
Normal file
118
.bin/Scripts/diagnostics
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Wizard Kit: SW Diagnostics
|
||||||
|
|
||||||
|
# Init
|
||||||
|
## Get .bin absolute path (dirty code roughly based on http://stackoverflow.com/a/12197227)
|
||||||
|
pushd . > /dev/null
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
BIN="$(pwd)"
|
||||||
|
popd > /dev/null
|
||||||
|
DATE="$(date "+%F")"
|
||||||
|
LOG_DIR="/WK/Info"
|
||||||
|
LOG_FILE="${LOG_DIR}/${DATE}/Diagnostics.log"
|
||||||
|
mkdir -p "${LOG_DIR}" 2>/dev/null
|
||||||
|
# . "$BIN/os_check"
|
||||||
|
|
||||||
|
# Setup color and message printing
|
||||||
|
export CLICOLOR=1
|
||||||
|
CLEAR="\033[0m"
|
||||||
|
RED="\033[31m"
|
||||||
|
GREEN="\033[32m"
|
||||||
|
YELLOW="\033[33m"
|
||||||
|
BLUE="\033[34m"
|
||||||
|
function print_error() {
|
||||||
|
echo -e "${RED}${1}${CLEAR}"
|
||||||
|
echo "${1}" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
function print_info() {
|
||||||
|
echo -e "${BLUE}${1}${CLEAR}"
|
||||||
|
echo "${1}" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
function print_success() {
|
||||||
|
echo -e "${GREEN}${1}${CLEAR}"
|
||||||
|
echo "${1}" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
function print_warning() {
|
||||||
|
echo -e "${YELLOW}${1}${CLEAR}"
|
||||||
|
echo "${1}" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
function print_general() {
|
||||||
|
echo "${1}"
|
||||||
|
echo "${1}" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get Ticket #
|
||||||
|
ticket=""
|
||||||
|
while [[ "${ticket}" == "" ]]; do
|
||||||
|
echo -n "Enter the ticket number: "
|
||||||
|
read _tmp
|
||||||
|
if echo "${_tmp}" | grep -Eq '^([0-9]+[-_0-9A-Za-z]*)$'; then
|
||||||
|
ticket="${_tmp}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Start
|
||||||
|
print_general "Starting SW Diagnostics"
|
||||||
|
print_general " For ticket #${ticket}"
|
||||||
|
|
||||||
|
# Sanitize Environment
|
||||||
|
|
||||||
|
# Network
|
||||||
|
print_general "Testing network connection..."
|
||||||
|
while ! ping -c 2 "google.com" >/dev/null 2>&1; do
|
||||||
|
print_warning "System appears offline. Please connect to the internet."
|
||||||
|
echo -n "Press Enter to try again... "
|
||||||
|
read _tmp
|
||||||
|
done
|
||||||
|
|
||||||
|
# Infection Scan
|
||||||
|
|
||||||
|
# OS Health
|
||||||
|
print_general "Checking disk permissions..."
|
||||||
|
/usr/libexec/repair_packages --verify --standard-pkgs >> "${LOG_DIR}/permissions.log"
|
||||||
|
if [[ "$(wc -l "${LOG_DIR}/permissions.log")" -ge "10" ]]; then
|
||||||
|
head -9 "${LOG_DIR}/permissions.log" | sed 's/^/ /' | tee -a "${LOG_FILE}"
|
||||||
|
print_general " ... $(echo "$(wc -l "${LOG_DIR}/permissions.log") - 9" | bc) lines omitted"
|
||||||
|
else
|
||||||
|
sed 's/^/ /' "${LOG_DIR}/permissions.log" | tee -a "${LOG_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Browser Backup
|
||||||
|
|
||||||
|
# Temp file size
|
||||||
|
print_general "Checking temp file size..."
|
||||||
|
du -sch ~/.Trash | sed 's/^/ /' | tee -a "${LOG_FILE}"
|
||||||
|
|
||||||
|
# Save System Info
|
||||||
|
print_general "System Information:"
|
||||||
|
# system_profiler
|
||||||
|
## HW
|
||||||
|
## Keys?
|
||||||
|
## OS
|
||||||
|
sw_vers | sed 's/^/ /' | tee -a "${LOG_FILE}"
|
||||||
|
|
||||||
|
## SW
|
||||||
|
|
||||||
|
# OS/SW Updates
|
||||||
|
softwareupdate -l | tee -a "${LOG_FILE}"
|
||||||
|
|
||||||
|
|
||||||
|
# Battery
|
||||||
|
#ioreg
|
||||||
|
|
||||||
|
# User data size
|
||||||
|
print_general "User data:"
|
||||||
|
pushd /Users >/dev/null
|
||||||
|
for user in $(dscl . -list /Users | grep -Ev '^(_|(daemon|nobody|root)$)'); do
|
||||||
|
print_general " $(id -F "$user") ($user)"
|
||||||
|
du -sch "$user/"* | sed 's/^/ /' | tee -a "${LOG_FILE}"
|
||||||
|
done
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
# Upload results
|
||||||
|
#rsync
|
||||||
|
|
||||||
|
# Open results
|
||||||
|
|
||||||
|
# Done
|
||||||
|
exit 0
|
||||||
13
Diagnostics/Disk Inventory X.command
Normal file
13
Diagnostics/Disk Inventory X.command
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Wizard Kit: Generic app launcher
|
||||||
|
|
||||||
|
# Init
|
||||||
|
## Get .bin absolute path (dirty code roughly based on http://stackoverflow.com/a/12197227)
|
||||||
|
pushd . > /dev/null
|
||||||
|
cd "$(dirname "$0")/../.bin"
|
||||||
|
BIN="$(pwd)"
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Run
|
||||||
|
"$BIN/Disk Inventory X.app/Contents/MacOS/Disk Inventory X" &
|
||||||
|
exit 0
|
||||||
6
Enable TRIM.command
Normal file
6
Enable TRIM.command
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Wizard Kit: Enable TRIM
|
||||||
|
|
||||||
|
# Run trimforce
|
||||||
|
sudo trimforce enable
|
||||||
|
exit 0
|
||||||
7
LICENSE.txt
Normal file
7
LICENSE.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright (c) 2016 Alan Mason
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
13
SW Diagnostics.command
Normal file
13
SW Diagnostics.command
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Wizard Kit: Start SW Diagnostics
|
||||||
|
|
||||||
|
# Init
|
||||||
|
## Get .bin absolute path (dirty code roughly based on http://stackoverflow.com/a/12197227)
|
||||||
|
pushd . > /dev/null
|
||||||
|
cd "$(dirname "$0")/.bin"
|
||||||
|
BIN="$(pwd)"
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Run
|
||||||
|
sudo "$BIN/Scripts/diagnostics"
|
||||||
|
exit 0
|
||||||
Loading…
Reference in a new issue