added existing
This commit is contained in:
14
scripts/git-update.sh
Normal file
14
scripts/git-update.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
packages="installed-packages.txt"
|
||||
|
||||
echo "writing packages into $packages"
|
||||
pacman -Qqe > $packages
|
||||
paru -Qqe >> $packages
|
||||
echo "finished packages into $packages"
|
||||
echo "copying files outside of home"
|
||||
cp /etc/fstab $HOME/.root/etc/
|
||||
cp -r /boot/grub/themes/* $HOME/.root/boot/grub/themes/
|
||||
echo "finished copying files outside of home"
|
||||
git add -u
|
||||
git commit -m 'update'
|
||||
git push
|
||||
50
scripts/mount.sh
Normal file
50
scripts/mount.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source the functions file
|
||||
source "$HOME/.config/function_helper.sh"
|
||||
|
||||
# Configuration
|
||||
SERVER_IP="192.168.1.22"
|
||||
CRENDENTIALS="$HOME/.cred/.smbcred"
|
||||
MOUNT_POINT_RAID="$HOME/Raid/"
|
||||
MOUNT_POINT_SSD="$HOME/Server-SSD/"
|
||||
PASSWORD_FILE="$HOME/.cred/credentials.txt"
|
||||
|
||||
# Read the password from the file
|
||||
PASSWORD=$(<"$PASSWORD_FILE")
|
||||
|
||||
# Function to mount all shares
|
||||
function mount_all() {
|
||||
if ping -c 1 -W 2 $SERVER_IP > /dev/null 2>&1; then
|
||||
send_notification "low" "Ping Successful" "$SERVER_IP is Up and Running. Continuing to mount." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/connect_established.svg"
|
||||
# Mount RAID
|
||||
if ! is_mounted "$MOUNT_POINT_RAID"; then
|
||||
if echo "$PASSWORD" | sudo -S mount -t cifs -o credentials="$CRENDENTIALS",uid=1000,gid=1000 //$SERVER_IP/RAID "$MOUNT_POINT_RAID"; then
|
||||
send_notification "low" "Mount Successful" "Mounted RAID at $MOUNT_POINT_RAID successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
||||
else
|
||||
send_notification "high" "Mount Failed" "Failed to mount RAID at $MOUNT_POINT_RAID." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
send_notification "low" "Already Mounted" "RAID is already mounted at $MOUNT_POINT_RAID." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
||||
fi
|
||||
|
||||
# Mount SSD
|
||||
if ! is_mounted "$MOUNT_POINT_SSD"; then
|
||||
if echo "$PASSWORD" | sudo -S mount -t cifs -o credentials="$CRENDENTIALS",uid=1000,gid=1000 //$SERVER_IP/Server-SSD "$MOUNT_POINT_SSD"; then
|
||||
send_notification "low" "Mount Successful" "Mounted SSD at $MOUNT_POINT_SSD successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
||||
else
|
||||
send_notification "high" "Mount Failed" "Failed to mount SSD at $MOUNT_POINT_SSD." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
send_notification "low" "Already Mounted" "SSD is already mounted at $MOUNT_POINT_SSD." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
||||
fi
|
||||
else
|
||||
send_notification "normal" "Connection Failed" "Could not connect to IP: $SERVER_IP." "$HOME/.icons/BeautyLine-Garuda/actions/scalable/network-disconnect.svg"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Call the mount_all function
|
||||
mount_all
|
||||
11
scripts/shutdown-server.sh
Normal file
11
scripts/shutdown-server.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
PASSWORD_FILE="$HOME/.cred/credentials_s.txt"
|
||||
PASSWORD=$(<"$PASSWORD_FILE")
|
||||
SERVERIP="192.168.0.1"
|
||||
USERNAME="Honney"
|
||||
COMMAND="shutdown /s /t 0"
|
||||
|
||||
send_notification "normal" "Shutingdown 2nd PC" "$SERVERIP" "$HOME/.icons/BeautyLine-Garuda/devices/scalable/server.svg"
|
||||
|
||||
sshpass\
|
||||
-p "$PASSWORD" ssh "$USERNAME"@"$SERVERIP" "$COMMAND"
|
||||
35
scripts/umount.sh
Normal file
35
scripts/umount.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source the functions file
|
||||
source "$HOME/.config/function_helper.sh"
|
||||
|
||||
# Define mount points
|
||||
MOUNT_POINT_RAID="$HOME/Raid/"
|
||||
MOUNT_POINT_SSD="$HOME/Server-SSD/"
|
||||
|
||||
PASSWORD_FILE="$HOME/.cred/credentials.txt"
|
||||
PASSWORD=$(<"$PASSWORD_FILE")
|
||||
|
||||
# Unmount RAID
|
||||
if is_mounted "$MOUNT_POINT_RAID"; then
|
||||
if echo "$PASSWORD" | sudo -S umount "$MOUNT_POINT_RAID"; then
|
||||
send_notification "low" "Unmount Successful" "Unmounted $MOUNT_POINT_RAID successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
||||
else
|
||||
send_notification "high" "Unmount Failed" "Failed to unmount $MOUNT_POINT_RAID." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
send_notification "low" "Not Mounted" "$MOUNT_POINT_RAID is not mounted." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
||||
fi
|
||||
|
||||
# Unmount SSD
|
||||
if is_mounted "$MOUNT_POINT_SSD"; then
|
||||
if echo "$PASSWORD" | sudo -S umount "$MOUNT_POINT_SSD"; then
|
||||
send_notification "low" "Unmount Successful" "Unmounted $MOUNT_POINT_SSD successfully." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-encrypted-symbolic.svg"
|
||||
else
|
||||
send_notification "high" "Unmount Failed" "Failed to unmount $MOUNT_POINT_SSD." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk-symbolic.svg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
send_notification "low" "Not Mounted" "$MOUNT_POINT_SSD is not mounted." "$HOME/.icons/BeautyLine-Garuda/devices/scalable/drive-harddisk.svg"
|
||||
fi
|
||||
Reference in New Issue
Block a user