blob: 5c22b19281bb6e5c13438f2169aed261c17605a6 (
plain)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# Maintainer: Zoey Bauer <zoey.erin.bauer@gmail.com>
# Maintainer: Caroline Snyder <hirpeng@gmail.com>
pkgname=shelly-bin
pkgver=2.4.1.4
pkgrel=1
pkgdesc="Shelly: A Modern Arch Package Manager (prebuilt binary)"
arch=('x86_64')
url="https://github.com/Seafoam-Labs/Shelly-ALPM"
license=('GPL-3.0-only')
provides=('shelly')
conflicts=('shelly' 'shelly-git')
depends=(
'pacman'
'gtk4'
'glib2'
'sudo'
'tar'
'bash'
'git'
'hicolor-icon-theme'
'dbus'
'glibc'
'libarchive'
'dconf'
'gnupg'
'zstd'
'json-glib'
)
optdepends=(
'flatpak: For supporting flatpak implementation.'
'fish: Fish shell completions'
'zsh: Zsh shell completions'
'libstarfish: dependency viewer for arch packages'
)
source=(
"Shelly-ALPM-linux-x64-${pkgver}.tar.gz::https://github.com/Seafoam-Labs/Shelly-ALPM/releases/download/v${pkgver}/Shelly-ALPM-linux-x64.tar.gz"
)
sha256sums=('f16960523135d31d1bf2059cb46fe8810ae745167a1d11b4dad844179464eb81')
package() {
# Install Shelly.Gtk binary
install -Dm755 "$srcdir/shelly-ui" "$pkgdir/usr/bin/shelly-ui"
# Install Shelly-Notifications binary
install -Dm755 "$srcdir/shelly-notifications" "$pkgdir/usr/bin/shelly-notifications"
# Install Shelly.Cli binary
install -Dm755 "$srcdir/shelly" "$pkgdir/usr/bin/shelly"
# Install Shelly.Keys binary
install -Dm755 "$srcdir/shelly-keys" "$pkgdir/usr/bin/shelly-keys"
# Install desktop entry
cat <<'EOF' | install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/com.shellyorg.shelly.desktop"
[Desktop Entry]
Name=Shelly
Comment=A Modern Arch Package Manager
Exec=/usr/bin/shelly-ui %u
Icon=shelly
Type=Application
Categories=System;Utility;
Keywords=program;software;store;repository;package;add;install;uninstall;remove;update;apps;applications;flatpak;pacman;aur;appimage;
MimeType=x-scheme-handler/appstream;x-scheme-handler/flatpak+https;
Terminal=false
Actions=FlatpakInstall;FlatpakUpdate;FlatpakRemove;
[Desktop Action FlatpakInstall]
Name=Flatpak Install
Icon=flatpak-symbolic
Exec=/usr/bin/shelly-ui --page flatpak-install
[Desktop Action FlatpakUpdate]
Name=Flatpak Update
Icon=flatpak-symbolic
Exec=/usr/bin/shelly-ui --page flatpak-update
[Desktop Action FlatpakRemove]
Name=Flatpak Remove
Icon=flatpak-symbolic
Exec=/usr/bin/shelly-ui --page flatpak-remove
EOF
# Install desktop entry for notification service
cat <<'EOF' | install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/com.shellyorg.shelly-notifications.desktop"
[Desktop Entry]
Name=Shelly Notifications
Comment=Notification service for Shelly package manager
Exec=/usr/bin/shelly-notifications
Icon=shelly-tray
Type=Application
Categories=System;Utility;
Keywords=program;software;store;repository;package;add;install;uninstall;remove;update;apps;applications;flatpak;pacman;aur;appimage;
Terminal=false
NoDisplay=true
EOF
# Ensure the polkit directory exists
install -m0755 -d "${pkgdir}"/usr/share/polkit-1/actions
# Install Polkit policy for privileged Shelly CLI execution via pkexec
cat <<'EOF' | install -Dm644 /dev/stdin "$pkgdir/usr/share/polkit-1/actions/com.shellyorg.shelly.policy"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>Shelly</vendor>
<vendor_url>https://github.com/Seafoam-Labs/Shelly-ALPM</vendor_url>
<action id="com.shellyorg.shelly.pkexec.cli">
<description>Run Shelly CLI as administrator</description>
<message>Run Shelly CLI with administrator privileges.</message>
<icon_name>shelly</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/shelly</annotate>
</action>
</policyconfig>
EOF
# Install icon
install -Dm644 "$srcdir/Assets/shellylogo.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/shelly.png"
install -Dm644 "$srcdir/Assets/svg/flatpak-symbolic.svg" "$pkgdir/usr/share/icons/hicolor/symbolic/apps/flatpak-symbolic.svg"
install -Dm644 "$srcdir/Assets/svg/arch-symbolic.svg" "$pkgdir/usr/share/icons/hicolor/symbolic/apps/arch-symbolic.svg"
install -Dm644 "$srcdir/Assets/svg/shelly-updates-symbolic.svg" "$pkgdir/usr/share/icons/hicolor/symbolic/apps/shelly-updates-symbolic.svg"
install -Dm644 "$srcdir/Assets/svg/shelly-shell-symbolic.svg" "$pkgdir/usr/share/icons/hicolor/symbolic/apps/shelly-shell-symbolic.svg"
install -Dm644 "$srcdir/Assets/shellylogo-tray.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/shelly-tray.png"
install -Dm644 "$srcdir/Assets/shellylogo-update.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/shelly-update.png"
# Install fish shell completions
install -Dm644 "$srcdir/shelly.fish" "$pkgdir/usr/share/fish/vendor_completions.d/shelly.fish"
# Install zsh shell completions
install -Dm644 "$srcdir/_shelly" "$pkgdir/usr/share/zsh/site-functions/_shelly"
# Install translations
if [ -d "$srcdir/locale" ] && [ -n "$(ls -A "$srcdir/locale" 2>/dev/null)" ]; then
install -d "$pkgdir/usr/share/locale"
cp -r "$srcdir/locale/."/* "$pkgdir/usr/share/locale/" 2>/dev/null || true
fi
# Install Flatpak integration script
cat <<'SCRIPT' | install -Dm755 /dev/stdin "$pkgdir/usr/bin/shelly-flatpak-integrate"
#!/bin/bash
# Adds "Manage in Shelly" right-click action to all Flatpak .desktop files
FLATPAK_DIRS=(
"/var/lib/flatpak/exports/share/applications"
"$HOME/.local/share/flatpak/exports/share/applications"
)
LOCAL_APPS_DIR="$HOME/.local/share/applications"
mkdir -p "$LOCAL_APPS_DIR"
for dir in "${FLATPAK_DIRS[@]}"; do
[ -d "$dir" ] || continue
for desktop_file in "$dir"/*.desktop; do
[ -f "$desktop_file" ] || continue
filename=$(basename "$desktop_file")
app_id="${filename%.desktop}"
dest="$LOCAL_APPS_DIR/$filename"
# Copy if override doesn't exist yet
[ -f "$dest" ] || cp "$desktop_file" "$dest"
# Skip if already patched
grep -q "ShellyManage" "$dest" && continue
# Add action to existing Actions= line or insert one
if grep -q "^Actions=" "$dest"; then
sed -i 's/^Actions=\(.*\)/Actions=\1ShellyManage;/' "$dest"
else
sed -i '/^\[Desktop Entry\]/a Actions=ShellyManage;' "$dest"
fi
cat >> "$dest" << EOF
[Desktop Action ShellyManage]
Name=Manage in Shelly
Icon=shelly
Exec=/usr/bin/shelly-ui --page flatpak-install
EOF
done
done
update-desktop-database "$LOCAL_APPS_DIR" 2>/dev/null || true
echo "Flatpak desktop entries patched with Shelly integration."
SCRIPT
}
|