-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaydroid.sh
50 lines (41 loc) · 1.66 KB
/
waydroid.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
#!/usr/bin/env bash
# Author: Alessandro Astone <[email protected]>
# Author: Czarek Nakamoto <[email protected]>
# Source: https://gist.github.com/aleasto/905154449bedb496054593363f074796
set -e
if [ -n "$1" ]; then
UPSTREAM_CODENAME="$1"
else
if [ -e /etc/os-release ]; then
OS_RELEASE=/etc/os-release
elif [ -e /usr/lib/os-release ]; then
OS_RELEASE=/usr/lib/os-release
fi
UPSTREAM_CODENAME=$(grep "^UBUNTU_CODENAME=" ${OS_RELEASE} | cut -d'=' -f2)
if [ -z "${UPSTREAM_CODENAME}" ]; then
UPSTREAM_CODENAME=$(grep "^DEBIAN_CODENAME=" ${OS_RELEASE} | cut -d'=' -f2)
fi
if [ -z "${UPSTREAM_CODENAME}" ]; then
UPSTREAM_CODENAME=$(grep "^VERSION_CODENAME=" ${OS_RELEASE} | cut -d'=' -f2)
fi
# Debian 12+
if [ -z "${UPSTREAM_CODENAME}" ] && [ -e /etc/debian_version ]; then
UPSTREAM_CODENAME=$(cut -d / -f 1 /etc/debian_version)
fi
if [ -z "${UPSTREAM_CODENAME}" ]; then
echo "[!] Could not detect your distribution. Please provide a valid option as first argument"
exit 1
fi
fi
# Remap
#if [ "${UPSTREAM_CODENAME}" = "kinetic" ]; then
# UPSTREAM_CODENAME="ubuntu-devel"
#fi
# Catch
if ! [[ "${UPSTREAM_CODENAME}" =~ ^(mantic|focal|jammy|kinetic|lunar|noble|bookworm|bullseye|trixie|sid)$ ]]; then
echo "[!] Distribution \"${UPSTREAM_CODENAME}\" is not supported"
exit 1
fi
curl --progress-bar --proto '=https' --tlsv1.2 -Sf https://repo.waydro.id/waydroid.gpg --output /usr/share/keyrings/waydroid.gpg
echo "deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ ${UPSTREAM_CODENAME} main" | tee /etc/apt/sources.list.d/waydroid.list
apt update