Uppladdning av script

This commit is contained in:
emanuel 2025-03-26 21:37:21 +01:00
commit 4335f55c67
10 changed files with 293 additions and 0 deletions

24
appimages.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
#Requires a template.desktop in /usr/share/applications
#
#
read -p "Enter filename: " file
read -p "Enter name: " name
read -p "Enter version: " version
echo "Making AppImage executable"
#Make appimage executable
#
sudo chmod +x ~/Applications/$name-$version.AppImage
# Copy template
#
sudo cp /usr/share/applications/template.desktop /usr/share/applications/$file.desktop
# Search for text to replace
#
if [[ $name != "oldname" && $version != "oldversion" ]]; then
sudo sed -i 's/oldversion/'$version'/g' /usr/share/applications/$file.desktop
sudo sed -i 's/oldname/'$name'/g' /usr/share/applications/$file.desktop
fi
echo "$file.desktop has been created"

30
btconnect.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# Configuration
DEVICE_MAC_ADDRESS="88:C9:E8:F4:4A:FF" # Replace with your device's MAC address
# Function to check if a device is connected
is_device_connected() {
bluetoothctl info "$DEVICE_MAC_ADDRESS" | grep -q "Connected: yes"
}
# Function to connect the device
connect_device() {
echo -e "connect $DEVICE_MAC_ADDRESS\nquit" | bluetoothctl
}
# Function to disconnect the device
disconnect_device() {
echo -e "disconnect $DEVICE_MAC_ADDRESS\nquit" | bluetoothctl
}
# Main logic
if is_device_connected; then
echo "Device $DEVICE_MAC_ADDRESS is already connected. Disconnecting..."
disconnect_device
else
echo "Device $DEVICE_MAC_ADDRESS is not connected. Connecting..."
connect_device
fi
exit 0

35
heic.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# Kontrollera om magick är installerat
if ! command -v magick &> /dev/null
then
echo "magick kunde inte hittas. Installera ImageMagick."
exit 1
fi
# Räknare för att generera unika filnamn
count=0
# Loopa igenom alla .heic-filer i mappen
for file in *.heic; do
# Öka räknaren
count=$((count+1))
# Formatera räknaren till fyra siffror med ledande nollor
padded_count=$(printf "%04d" $count)
# Skapa det nya filnamnet
new_file_name="IMG_${padded_count}.jpeg"
# Konvertera filen
magick convert "$file" "$new_file_name"
# Kontrollera om konverteringen lyckades
if [ $? -eq 0 ]; then
echo "Konverterade $file till $new_file_name"
else
echo "Misslyckades med att konvertera $file"
fi
done
echo "Konvertering av .heic-filer till .jpeg avslutad."

100
multisave.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
NC='\033[0m' # No Color
RED='\033[0;31m'
LB='\033[1;34m' #Lightblue
read -p "Press [Enter] key to start the backup process..."
## Bash add a pause for 1 seconds ##
read -t 1 -p ""
echo ""
PS3="Choose what game to backup: "
greeting="Welcome, time to backup your savefiles!"
user=$(whoami)
day=$(date +%A)
date=$(date +"%F-%H")
select opt in EldenRing LiesOfP Sekiro GhostOfTsushima Exit; do
case $opt in
EldenRing)
mkdir /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo -e "${RED}Created the folder ${LB}$date"
echo -e "${NC}"
cp /home/emanuel/Games/elden-ring/drive_c/users/emanuel/AppData/Roaming/$opt/GraphicsConfig.xml /home/emanuel/NAS/Spel/$opt/$date
cp -r /home/emanuel/Games/elden-ring/drive_c/users/emanuel/AppData/Roaming/$opt/76561197960267366 /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo ""
echo ""
echo -e "Savefile for ${LB}$opt has been backed up for the user ${RED}$user!"
echo -e "${NC}"
read -t 2 -p "Exiting Script"
echo ""
exit
;;
LiesOfP)
mkdir /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo -e "${RED}Created the folder ${LB}$date"
echo -e "${NC}"
cp /home/emanuel/Games/liesofp/drive_c/users/emanuel/AppData/Roaming/$opt/GraphicsConfig.xml /home/emanuel/NAS/Spel/$opt/$date
cp -r /home/emanuel/Games/liesofp/drive_c/users/emanuel/AppData/Roaming/$opt/76561197960267366 /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo ""
echo ""
echo -e "Savefile for ${LB}$opt has been backed up for the user ${RED}$user!"
echo -e "${NC}"
read -t 2 -p "Exiting Script"
echo ""
exit
;;
Sekiro)
mkdir /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo -e "${RED}Created the folder ${LB}$date"
echo -e "${NC}"
cp /home/emanuel/Games/sekiro/drive_c/users/emanuel/AppData/Roaming/$opt/GraphicsConfig.xml /home/emanuel/NAS/Spel/$opt/$date
cp -r /home/emanuel/Games/sekiro/drive_c/users/emanuel/AppData/Roaming/$opt/76561197960267366 /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo ""
echo ""
echo -e "Savefile for ${LB}$opt has been backed up for the user ${RED}$user!"
echo -e "${NC}"
read -t 2 -p "Exiting Script"
echo ""
exit
;;
GhostOfTsushima)
mkdir /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo -e "${RED}Created the folder ${LB}$date"
echo -e "${NC}"
#cp /home/emanuel/Games/sekiro/drive_c/users/emanuel/AppData/Roaming/$opt/GraphicsConfig.xml /home/emanuel/NAS/Spel/$opt/$date
cp -r /home/emanuel/Games/ghost-of-tsushima/drive_c/users/steamuser/Documents /home/emanuel/NAS/Spel/$opt/$date
read -t 2 -p ""
echo ""
echo ""
echo -e "Savefile for ${LB}$opt has been backed up for the user ${RED}$user!"
echo -e "${NC}"
read -t 2 -p "Exiting Script"
echo ""
exit
;;
Exit)
read -t 2 -p ""
echo ""
echo ""
echo "Nothing was done, exiting the script"
exit
;;
*)
echo "invalid option $REPLY"
;;
esac
done

10
ps5.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
device="4C:B9:9B:D2:FC:FF"
if bluetoothctl info "$device" | grep 'Connected: yes' -q; then
echo "Redan uppkopplad"
bluetoothctl disconnect "$device"
else
bluetoothctl connect "$device"
fi

24
ssh.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
PS3="What server do you want to SSH to?: "
select opt in Nextcloud Wireguard Jellyfin quit; do
case $opt in
Nextcloud)
ssh nextcloud@192.168.1.205
;;
Wireguard)
ssh wireguard@192.168.1.202
;;
Jellyfin)
ssh jellyfin@192.168.1.225
;;
quit)
echo "Exiting script"
exit
;;
*)
echo "Invalid option $REPLY"
;;
esac
done

17
sshconnect.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
ps3="What server do you want to connect to?"
select server in Nextcloud Wireguard Jellyfin Quit
do
if [ $server == Nextcloud ]
echo "You are connecting to $server"
then
ssh nextcloud@192.168.1.205
elif [ $server == Wireguard ]
then
ssh wireguard@192.168.1.202
elif [ $server == Jellyfin ]
then ssh jellyfin@192.168.1.225
fi
done

14
while.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
first_greeting="Nice to meet you!"
later_greeting="How are you?"
greeting=0
while [ $greeting -lt 3 ]
do
if [ $greeting -lt 1 ]
then
echo $first_greeting
else
echo $later_greeting
fi
greeting=$((greeting + 1))
done

29
wifimult.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#Colors
RED='\033[0;31m'
NC='\033[0m' # No Color
LB='\033[1;34m' #Lightblue color
#Start of script
PS3="Chose Wi-Fi: "
#selections
select opt in soaplink5G 'Emanuel - iPhone' Exit; do
case $opt in
soaplink5G)
nmcli device wifi connect soaplink5G
echo -e "${LB}Connecting to ${RED}$opt"
exit
;;
'Emanuel - iPhone')
nmcli device wifi connect 12:82:A7:51:1E:59
echo -e "${LB}Connecting to ${RED}$opt"
exit
;;
Exit)
echo -e "${LB}No connection made, ${RED}closing."
exit
;;
*)
esac
done

10
xbox.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
device="40:8E:2C:03:25:E5"
if bluetoothctl info "$device" | grep 'Connected: yes' -q; then
echo "Redan uppkopplad"
bluetoothctl disconnect "$device"
else
bluetoothctl connect "$device"
fi