-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f *; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
BASE_REPO_URL="https://raw.githubusercontent.com/jpfulton/example-linux-configs/main"; | ||
|
||
# Set up eviction query and shutdown script | ||
EVICTION_QUERY_CRON_SNIPPET_FILE="preempt-query"; | ||
EVICTION_QUERY_SCRIPT="query-for-preempt-event.sh"; | ||
echo "Setting up eviction query script..."; | ||
|
||
sudo wget -q ${BASE_REPO_URL}/usr/local/sbin/${EVICTION_QUERY_SCRIPT}; | ||
sudo chmod ug+x ./${EVICTION_QUERY_SCRIPT} | ||
sudo mv ./${EVICTION_QUERY_SCRIPT} /usr/local/sbin/ | ||
|
||
sudo wget -q ${BASE_REPO_URL}/etc/cron.d/${EVICTION_QUERY_CRON_SNIPPET_FILE}; | ||
sudo mv ./${EVICTION_QUERY_CRON_SNIPPET_FILE} /etc/cron.d/ | ||
|
||
echo "---"; | ||
echo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
BASE_REPO_URL="https://raw.githubusercontent.com/jpfulton/example-linux-configs/main"; | ||
|
||
# Set up local firewall basics | ||
DEFAULTS_PATH="/etc/default/"; | ||
UFW_DEFAULTS_FILE="ufw"; | ||
if [ $(sudo ufw status | grep -c inactive) -ge 1 ] | ||
then | ||
echo "Local firewall is inactive. Configuring and enabling with SSH rule..."; | ||
|
||
sudo wget -q ${BASE_REPO_URL}${DEFAULTS_PATH}${UFW_DEFAULTS_FILE} -O ${UFW_DEFAULTS_FILE}; | ||
sudo mv ${UFW_DEFAULTS_FILE} ${DEFAULTS_PATH}; | ||
|
||
sudo ufw allow ssh; | ||
sudo ufw show added; | ||
sudo ufw --force enable; | ||
sudo ufw status numbered; | ||
|
||
else | ||
echo "Local fireall is active. No configuration or rules applied."; | ||
fi | ||
echo "---"; | ||
echo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
DEBIAN_FRONTEND="noninteractive"; | ||
BASE_REPO_URL="https://raw.githubusercontent.com/jpfulton/example-linux-configs/main"; | ||
|
||
# Set up custom MOTD script | ||
MOTD_PATH="/etc/update-motd.d/"; | ||
MOTD_FILE="01-custom"; | ||
if [ ! -f ${MOTD_PATH}${MOTD_FILE} ] | ||
then | ||
echo "Setting up custom MOTD script..."; | ||
|
||
sudo -E apt-get install -y neofetch inxi; | ||
sudo wget -q ${BASE_REPO_URL}${MOTD_PATH}${MOTD_FILE} -O ${MOTD_FILE}; | ||
sudo chmod a+x ./${MOTD_FILE}; | ||
sudo mv ./${MOTD_FILE} ${MOTD_PATH}${MOTD_FILE}; | ||
|
||
echo "---"; | ||
echo; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
DEBIAN_FRONTEND="noninteractive"; | ||
BASE_REPO_URL="https://raw.githubusercontent.com/jpfulton/example-linux-configs/main"; | ||
|
||
setup-nodejs () { | ||
# Install Node as needed | ||
which node >> /dev/null; | ||
if [ $? -eq 0 ] | ||
then | ||
local NODE_VERSION=$(node --version); | ||
if [ $NODE_VERSION == "v12.22.9" ] | ||
then | ||
echo "Default node package detected. Removing."; | ||
sudo -E apt-get remove nodejs; | ||
sudo -E apt-get autoremove; | ||
else | ||
echo "Detected alternate version of node: ${NODE_VERSION}"; | ||
echo "Ensure that version is above v18.0.0 or manually use nvm."; | ||
fi | ||
else | ||
echo "Node not detected. Preparing installation of node v18.x."; | ||
|
||
sudo curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -; | ||
sudo -E apt-get install -y nodejs; | ||
fi | ||
|
||
echo "---"; | ||
echo; | ||
} | ||
|
||
setup-yarn () { | ||
# Install Yarn as needed | ||
which yarn >> /dev/null; | ||
if [ $? -eq 1 ] | ||
then | ||
echo "Yarn not detected. Preparing to install."; | ||
|
||
sudo curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null; | ||
sudo echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list; | ||
sudo -E apt-get update; | ||
sudo -E apt-get install -y yarn; | ||
else | ||
local YARN_VERSION=$(yarn --version); | ||
echo "Found yarn version: ${YARN_VERSION}"; | ||
fi | ||
|
||
echo "---"; | ||
echo; | ||
} | ||
|
||
setup-nodejs; | ||
setup-yarn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Install or upgrade sms-notify-cli utility | ||
which sms-notify-cli >> /dev/null; | ||
if [ $? -eq 1 ] | ||
then | ||
echo "sms-notify-cli utility not detected. Preparing to install."; | ||
sudo yarn global add @jpfulton/net-sms-notifier-cli; | ||
else | ||
echo "Found sms-notify-cli utility. Attempting update."; | ||
sudo yarn global upgrade @jpfulton/net-sms-notifier-cli@latest; | ||
fi | ||
echo "---"; | ||
echo; | ||
|
||
# Initialize sms-notify-cli configuration | ||
NOTIFIER_CONFIG="/etc/sms-notifier/notifier.json"; | ||
if [ -f $NOTIFIER_CONFIG ] | ||
then | ||
echo "Found notifier configuration. Validating with current version."; | ||
|
||
sudo sms-notify-cli validate; | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Configuration file validation passes on current version."; | ||
else | ||
echo "Invalid configuration file. Manually correct."; | ||
fi | ||
else | ||
echo "No notifier configuration found. Initializing..."; | ||
echo "Manual configuration to the ${NOTIFIER_CONFIG} file will be required."; | ||
sudo sms-notify-cli init; | ||
fi | ||
|
||
echo "---"; | ||
echo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
sudo chown root:root ~/notifier.json | ||
sudo chmod 0640 ~/notifier.json | ||
sudo mv ~/notifier.json /etc/sms-notifier/notifier.json | ||
|
||
echo "---"; | ||
echo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters