-
Notifications
You must be signed in to change notification settings - Fork 10
/
install_1password.sh
92 lines (78 loc) · 2.51 KB
/
install_1password.sh
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
#!/bin/bash
#This script installs aarch64 appimages into debian proot /opt directory and creates a desktop and menu launcher
# Default values to edit
#Enter URL to appimage
url="https://downloads.1password.com/linux/tar/stable/aarch64/1password-latest.tar.gz"
#Enter name of app
appname="1password"
#Enter path to icon or system icon name
icon_path="1password"
#Enter Categories for .desktop
category="System"
#Enter any dependencies
depends=""
#Do not edit below here unless required
# Process command line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--install)
install=true
shift
;;
--uninstall)
uninstall=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
if [ "$install" = true ]; then
download="wget $url"
strip="--strip-components=1"
extract="tar -xzf ${url##*/} -C $appname $strip" #-xvf is tar.xz or -xzf if tar.gz
dir="/opt/$appname"
varname=$(basename $HOME/../usr/var/lib/proot-distro/installed-rootfs/debian/home/*)
prun="proot-distro login debian --user $varname --shared-tmp -- env DISPLAY=:1.0 $@"
$prun $download
$prun mkdir -p $appname
$prun $extract
$prun mv $appname $dir
$prun rm ${url##*/}
installed_dir="$HOME/../usr/var/lib/proot-distro/installed-rootfs/debian/$dir"
desktop_file="$HOME/Desktop/$appname.desktop"
binary=$(find "$installed_dir" -type f -executable -print -quit)
#If binary is different, specify it here after $installed_dir/ and use $alt_binary instead of $binary
alt_binary="1password"
#If binary is sandboxed use $sandboxed at end of Exec command
sandboxed="--no-sandbox"
#NOTE: Do not remove prun from Exec command
cat > "$desktop_file" <<EOL
[Desktop Entry]
Version=1.0
Type=Application
Name=$appname
Comment=Web Browser
Exec=prun $installed_dir/$alt_binary $sandboxed
Icon=$icon_path
Categories=$category
Terminal=false
EOL
chmod +x "$desktop_file"
cp "$desktop_file" $HOME/../usr/share/applications
echo "Installation completed."
elif [ "$uninstall" = true ]; then
echo "Uninstalling..."
dir="/opt/$appname"
installed_dir="$HOME/../usr/var/lib/proot-distro/installed-rootfs/debian/$dir"
rm -rf "$installed_dir"
desktop_file="$HOME/Desktop/$appname.desktop"
rm "$desktop_file"
rm "$HOME/../usr/share/applications/$appname.desktop"
echo "Uninstallation completed."
else
echo "No valid option provided. Use --install or --uninstall."
exit 1
fi