more setuppp 3
This commit is contained in:
@@ -1,6 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
finalDir='/usr/share/customscripts'
|
finalDir='/usr/share/customscripts'
|
||||||
|
|
||||||
|
fix_perms() {
|
||||||
|
# fix ownership
|
||||||
|
echo -e "\nChanging ownership of $finalDir to $username:$username recursively"
|
||||||
|
sudo chown -R $username:$username $finalDir
|
||||||
|
|
||||||
|
# fix perms
|
||||||
|
echo -e "\nSetting perms of $finalDir and contents to 775"
|
||||||
|
sudo chmod -R 775 $finalDir
|
||||||
|
}
|
||||||
|
|
||||||
# ta get da right usermayhaps
|
# ta get da right usermayhaps
|
||||||
if [[ -z $SUDO_USER ]]; then
|
if [[ -z $SUDO_USER ]]; then
|
||||||
echo "Using User $USER"
|
echo "Using User $USER"
|
||||||
@@ -12,6 +22,24 @@ fi
|
|||||||
|
|
||||||
echo -e "\nConfigure Discord Webhook Settings"
|
echo -e "\nConfigure Discord Webhook Settings"
|
||||||
|
|
||||||
|
if [ -f /tmp/tag.txt ] && [ -f /tmp/webhook.txt ] && [ $webhook -eq 0 ]; then
|
||||||
|
echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n"
|
||||||
|
existing_webhook=$(cat /tmp/webhook.txt)
|
||||||
|
existing_tag=$(cat /tmp/tag.txt)
|
||||||
|
|
||||||
|
# move em into place
|
||||||
|
sudo mv /tmp/tag.txt $finalDir/tag.txt
|
||||||
|
sudo mv /tmp/webhook.txt $finalDir/webhook.txt
|
||||||
|
|
||||||
|
echo -e "Existing Webhook URL: $existing_webhook"
|
||||||
|
echo -e "Existing Tag: $existing_tag\n"
|
||||||
|
|
||||||
|
# update permissions
|
||||||
|
fix_perms
|
||||||
|
|
||||||
|
exit 0 # exit ok
|
||||||
|
fi
|
||||||
|
|
||||||
# get webhook url
|
# get webhook url
|
||||||
echo -e "\nEnter Discord Webhook URL"
|
echo -e "\nEnter Discord Webhook URL"
|
||||||
read webhook_url
|
read webhook_url
|
||||||
@@ -24,12 +52,6 @@ read webhook_tag
|
|||||||
sudo bash -c "echo '$webhook_url' > $finalDir/webhook.txt"
|
sudo bash -c "echo '$webhook_url' > $finalDir/webhook.txt"
|
||||||
sudo bash -c "echo '$webhook_tag' > $finalDir/tag.txt"
|
sudo bash -c "echo '$webhook_tag' > $finalDir/tag.txt"
|
||||||
|
|
||||||
# fix ownership
|
fix_perms
|
||||||
echo -e "\nChanging ownership of $finalDir to $username:$username recursively"
|
|
||||||
sudo chown -R $username:$username $finalDir
|
|
||||||
|
|
||||||
# fix perms
|
|
||||||
echo -e "\nSetting perms of $finalDir and contents to 775"
|
|
||||||
sudo chmod -R 775 $finalDir
|
|
||||||
|
|
||||||
echo -e "\n\nDone! Restarting shell..."
|
echo -e "\n\nDone! Restarting shell..."
|
||||||
|
|||||||
@@ -33,13 +33,25 @@ else
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clean up any existing install
|
# get the existing tag and webhooks if any
|
||||||
|
webhook=1
|
||||||
|
if [ -f $finalDir/tag.txt ]; then
|
||||||
|
echo "Found existing tag.txt, backing up"
|
||||||
|
cp $finalDir/tag.txt /tmp/tag.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $finalDir/webhook.txt ]; then
|
||||||
|
echo "Found existing webhook.txt, backing up"
|
||||||
|
cp $finalDir/webhook.txt /tmp/webhook.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clean up any exisiting repo dir
|
||||||
if [[ -d "$tmpDir" ]]; then
|
if [[ -d "$tmpDir" ]]; then
|
||||||
echo "Cleaning Up Existing $tmpDir"
|
echo "Cleaning Up Existing $tmpDir"
|
||||||
rm -rf "$tmpDir"
|
rm -rf "$tmpDir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clean up any exisiting repo dir
|
# clean up any existing install
|
||||||
if [[ -d "$finalDir" ]]; then
|
if [[ -d "$finalDir" ]]; then
|
||||||
echo "Cleaning Up Existing $finalDir"
|
echo "Cleaning Up Existing $finalDir"
|
||||||
rm -rf "$finalDir"
|
rm -rf "$finalDir"
|
||||||
|
|||||||
Reference in New Issue
Block a user