-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-audacity.sh
More file actions
executable file
·133 lines (106 loc) · 3.27 KB
/
Copy pathinstall-audacity.sh
File metadata and controls
executable file
·133 lines (106 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# --- External Functions ---
source lib/notify_lib.sh
# --- Variables ---
INSTALL_DIR="$HOME/.local/bin"
DESKTOP_DIR="$HOME/.local/share/applications"
APPNAME="audacityportable"
# --- Functions ---
help() {
cat << EOF
Usage: $0 [option] [version]
Options:
-h Show this help message
-i VERSION Install Audacity version VERSION
-u Uninstall Audacity
Examples:
$0 -i 3.7.5
$0 -u
EOF
exit 1
}
install() {
VERSION="$1"
if [ -z "$VERSION" ]; then
notify "You must specify a version to install." "error"
help
fi
# Si hay versiones previas, eliminarlas
EXISTING=$(ls "$INSTALL_DIR"/audacity-linux-*-x64-22.04.AppImage 2>/dev/null)
if [ -n "$EXISTING" ]; then
notify "Previous Audacity version found. Removing..."
uninstall
fi
URL="https://github.com/audacity/audacity/releases/download/Audacity-$VERSION/audacity-linux-$VERSION-x64-22.04.AppImage"
FILENAME="audacity-linux-$VERSION-x64-22.04.AppImage"
mkdir -p "$INSTALL_DIR"
notify "Downloading Audacity $VERSION..."
wget -O "$INSTALL_DIR/$FILENAME" "$URL" || { echo "Download failed"; exit 1; }
chmod +x "$INSTALL_DIR/$FILENAME"
# Create symlink
ln -sf "$INSTALL_DIR/$FILENAME" "$INSTALL_DIR/$APPNAME"
# Create desktop file
mkdir -p "$DESKTOP_DIR"
DESKTOP_FILE="$DESKTOP_DIR/$APPNAME.desktop"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Name=Audacity
GenericName=Sound Editor
GenericName[es]=Editor de audio
Comment=Record and edit audio files
Comment[es]=Grabar y editar archivos de audio
Icon=audacity
StartupWMClass=Audacity
Type=Application
Categories=AudioVideo;Audio;AudioVideoEditing;
Keywords=sound;music editing;voice channel;frequency;modulation;audio trim;clipping;noise reduction;multi track audio editor;edit;mixing;WAV;AIFF;FLAC;MP2;MP3;
Exec=$INSTALL_DIR/$FILENAME %F
StartupNotify=false
Terminal=false
MimeType=application/x-audacity-project;application/x-audacity-project+sqlite3;audio/basic;audio/x-aiff;audio/x-wav;audio/aac;audio/ac3;audio/mp4;audio/x-ms-wma;video/mpeg;audio/flac;audio/x-flac;audio/mpeg;application/ogg;audio/x-vorbis+ogg;
EOF
notify "Audacity $VERSION installed successfully!" "success"
}
uninstall() {
# Check if any AppImage exists
APPIMAGE=$(ls "$INSTALL_DIR"/audacity-linux-*-x64-22.04.AppImage 2>/dev/null)
if [ -z "$APPIMAGE" ]; then
notify "Audacity is not installed in $INSTALL_DIR" "info"
exit 1
fi
# Remove AppImage
rm -f "$INSTALL_DIR"/audacity-linux-*-x64-22.04.AppImage
# Remove symlink
rm -f "$INSTALL_DIR/$APPNAME"
# Remove desktop file
rm -f "$DESKTOP_DIR/$APPNAME.desktop"
# Remove Audacity URL handler desktop if exists
if [ -f "$DESKTOP_DIR/audacity-url-handler.desktop" ]; then
rm -f "$DESKTOP_DIR/audacity-url-handler.desktop"
fi
notify "Audacity uninstalled successfully." "success"
}
main() {
if [ $# -eq 0 ]; then
help
fi
case "$1" in
-h)
help
;;
-i)
install "$2"
;;
-u)
uninstall
;;
-a)
upgrade "$2"
;;
*)
echo "Unknown option: $1"
help
;;
esac
}
main "$@"