vyvir / althea

althea sideloads applications on iOS/iPadOS!
GNU Affero General Public License v3.0
175 stars 23 forks source link

Rewrote autostart #11

Closed vindeckyy closed 3 months ago

vindeckyy commented 1 year ago

The script now creates the target directory ($target_dir) using mkdir -p before writing the file to it, ensuring the directory exists. Variables are used to store file paths, making the code more readable and maintainable. The cat command now uses > to write the content directly to the file, removing the need for tee and redirecting the output to /dev/null. The rm command now uses the variable for the desktop file path instead of repeating the path.

!/bin/bash

Set the target directory

target_dir="/home/$(whoami)/.local/share/altlinux"

Create the target directory if it doesn't exist

mkdir -p "$target_dir" || exit

Set the file paths

desktop_file="$target_dir/AltLinux.desktop" autostart_file="/home/$(whoami)/.config/autostart/AltLinux.desktop"

Create the desktop entry

cat < "$desktop_file" [Desktop Entry] Name=AltLinux GenericName=AltServer for Linux Path=/usr/lib/altlinux Exec=/usr/lib/altlinux/altlinux Terminal=false Type=Application X-GNOME-Autostart-enabled=true EOF

Copy the desktop entry to the autostart directory

cp "$desktop_file" "$autostart_file"

Remove the original desktop entry

rm "$desktop_file"

vyvir commented 3 months ago

Hi! This code looks like it was generated entirely in ChatGPT, so I will have to pass 😅