-
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
5 changed files
with
79 additions
and
2 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,66 @@ | ||
#!/bin/bash | ||
|
||
# Map of source directories to mount locations | ||
declare -A MOUNT_MAP=( | ||
["/home/aneem/jellyfin-movies"]="jellyfin-movies" | ||
["/home/aneem/.int-certs"]="int" | ||
["/home/aneem/Downloads"]="downloads" | ||
["/run/media/aneem/OMEGA/BACKUPS/NEW-SSD/EndeavourOS2024/HOME/.int-certs/images/"]="int-img" | ||
["/run/media/aneem/OMEGA/BACKUPS/NEW-SSD/EndeavourOS2024/HOME/.int-certs/videos/"]="int-vid" | ||
) | ||
|
||
# Root path to be added to each destination path | ||
MOUNT_ROOT_PATH="/media/" | ||
|
||
# jellyfin-start function | ||
jellyfin-start() { | ||
echo "Starting Jellyfin service..." | ||
# Start the jellyfin service | ||
sudo systemctl start jellyfin | ||
|
||
# Allow TCP traffic to port 8096 for the current session | ||
echo "Configuring firewall to allow TCP traffic on port 8096..." | ||
sudo firewall-cmd --add-port=8096/tcp | ||
|
||
# Mount directories based on the map | ||
for SOURCE in "${!MOUNT_MAP[@]}"; do | ||
DESTINATION="${MOUNT_ROOT_PATH}${MOUNT_MAP[$SOURCE]}" | ||
if [[ -d "$SOURCE" && -d "$DESTINATION" ]]; then | ||
echo "Mounting $SOURCE to $DESTINATION..." | ||
sudo mount --bind "$SOURCE" "$DESTINATION" | ||
else | ||
echo "Skipping $SOURCE -> $DESTINATION. Ensure both directories exist." | ||
fi | ||
done | ||
} | ||
|
||
# jellyfin-stop function | ||
jellyfin-stop() { | ||
echo "Stopping Jellyfin service..." | ||
# Stop the jellyfin service | ||
sudo systemctl stop jellyfin | ||
|
||
# Remove the TCP port allowance from the firewall | ||
echo "Removing firewall rule for TCP traffic on port 8096..." | ||
sudo firewall-cmd --remove-port=8096/tcp | ||
|
||
# Unmount directories based on the map | ||
for SOURCE in "${!MOUNT_MAP[@]}"; do | ||
DESTINATION="${MOUNT_ROOT_PATH}${MOUNT_MAP[$SOURCE]}" | ||
if mountpoint -q "$DESTINATION"; then | ||
echo "Unmounting $DESTINATION..." | ||
sudo umount "$DESTINATION" | ||
else | ||
echo "$DESTINATION is not mounted. Skipping..." | ||
fi | ||
done | ||
} | ||
|
||
# Help message | ||
if [[ "$1" == "start" ]]; then | ||
jellyfin-start | ||
elif [[ "$1" == "stop" ]]; then | ||
jellyfin-stop | ||
else | ||
echo "Usage: $0 {start|stop}" | ||
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
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,5 @@ | ||
listener { | ||
timeout = 60 # in seconds. | ||
on-timeout = notify-send "You are idle!" # command to run when timeout has passed. | ||
on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired. | ||
} |
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
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 @@ | ||
sudo sed -i -e 's/Current=/Current=maldives/g' /usr/lib/sddm/sddm.conf.d/default.conf |