DistroHopper/public/manjaro
2026-11-29 05:46:38 +01:00

148 lines
4.4 KiB
Text

# Template file for 'manjaro'
OSNAME="manjaro"
PRETTY="Manjaro"
LOGO=" "
ICON="manjaro.svg"
ICON_ONLINE=""
CATEGORY="Beginner"
BASEDOF="Arch"
DESCRIPTION="Versatile, free, and open-source Linux operating system designed with a strong focus on safeguarding user privacy and offering extensive control over hardware"
HOMEPAGE="https://manjaro.org"
CREDENTIALS="-"
GPG=""
RSS=""
DW=""
MAGNET=""
MAGNET_PREFERRED=""
TORRENT=""
CHAT=""
RELEASES="xfce sway plasma i3 gnome cinnamon"
EDITIONS="full minimal"
EDITIONS_LIST="full
minimal"
QEMU_ARCH="amd64"
_release_editions_() {
case "${1:-}" in
"amd64|i3") echo "full minimal" ;;
"amd64|plasma") echo "full minimal" ;;
"amd64|cinnamon") echo "full minimal" ;;
"amd64|xfce") echo "full minimal" ;;
"amd64|gnome") echo "full minimal" ;;
"amd64|sway") echo "full" ;;
*) return 1 ;;
esac
}
releases_() {
echo xfce gnome plasma cinnamon i3 sway
}
editions_() {
if [[ "${RELEASE}" == sway ]]; then
echo full
else
echo full minimal
fi
}
get_() {
local HASH=""
local URL=""
local MANIFEST=""
local TYPE="official"
case "${RELEASE}" in
sway)
MANIFEST="$(web_pipe https://manjaro-sway.download/iso/)"
local VERSION
VERSION=$(printf '%s' "${MANIFEST}" | grep -oE '/iso/[0-9]{12}/' | head -n 1 | awk -F/ '{print $3}')
[ -n "${VERSION}" ] || return 0
URL="https://manjaro-sway.download/iso/latest/manjaro-sway.iso"
HASH=$(web_pipe "https://manjaro-sway.download/iso/${VERSION}/SHA256SUMS" |
awk '$2 ~ /manjaro-sway-.*[.]iso$/ { print $1; exit }')
echo "${URL} ${HASH}"
return 0
;;
cinnamon|i3)
# Community editions are published on GitHub as split zip archives
# (.iso.zip + .iso.z01 + .iso.z02) which 7z reassembles into an ISO.
local GH_API="https://api.github.com/repos/manjaro/community-editions/releases?per_page=20"
local GH_JSON
GH_JSON="$(web_pipe "${GH_API}")"
[ -n "${GH_JSON}" ] || return 1
printf '%s' "${GH_JSON}" | jq -e 'type == "array"' >/dev/null 2>&1 || return 0
local TAG=""
local ASSET_NAME=""
local t ASSET
while IFS= read -r t; do
[ -z "${t}" ] && continue
ASSET="$(printf '%s' "${GH_JSON}" | jq -r --arg tag "${t}" --arg rel "${RELEASE}" --arg ed "${EDITION}" '
.[] | select(.tag_name == $tag) | .assets[].name |
select(test("manjaro-" + $rel + "-.*\\.iso\\.zip$")) |
select(($ed == "minimal") == (test("-minimal-")))
' | head -n 1)"
if [ -n "${ASSET}" ]; then
TAG="${t}"
ASSET_NAME="${ASSET}"
break
fi
done < <(printf '%s' "${GH_JSON}" | jq -r '.[].tag_name')
[ -n "${TAG}" ] && [ -n "${ASSET_NAME}" ] || return 0
URL="https://github.com/manjaro/community-editions/releases/download/${TAG}/${ASSET_NAME}"
# The ISO sha256 is published alongside the split archive.
local SHA_ASSET="${ASSET_NAME%.zip}.sha256"
local SHA_URL="https://github.com/manjaro/community-editions/releases/download/${TAG}/${SHA_ASSET}"
HASH="$(web_pipe "${SHA_URL}" | awk '{print $1; exit}')"
echo "${URL} ${HASH}"
return 0
;;
esac
local PROJECT="manjarolinux"
local DESKTOP="${RELEASE}"
[ "${DESKTOP}" == plasma ] && DESKTOP=kde
local ROOT="https://sourceforge.net/projects/${PROJECT}/files/${DESKTOP}"
local PAGE
local VERSION
local ISO_LIST
VERSION=$(web_pipe "${ROOT}/" |
grep -oE "/projects/${PROJECT}/files/${DESKTOP}/[0-9]+([.][0-9]+)+/" |
awk -F/ '{print $6}' | sort -Vr | head -n 1)
[ -n "${VERSION}" ] || return 0
PAGE=$(web_pipe "${ROOT}/${VERSION}/")
ISO_LIST=$(printf '%s' "${PAGE}" |
grep -oE "https://sourceforge.net/projects/${PROJECT}/files/${DESKTOP}/${VERSION}/[^\"[:space:]]+[.]iso/download")
if [ "${EDITION}" == minimal ]; then
URL=$(printf '%s\n' "${ISO_LIST}" | grep -F -- '-minimal-' | head -n 1)
else
URL=$(printf '%s\n' "${ISO_LIST}" | grep -vF -- '-minimal-' | head -n 1)
fi
[ -n "${URL}" ] || return 0
HASH=$(web_pipe "${URL%/download}.sha512/download" | cut -d' ' -f1)
echo "${URL} ${HASH}"
}
releases_() {
# Releases parsed at generation time — no network access needed.
echo "${RELEASES}"
}
editions_() {
# Editions parsed at generation time — no network access needed.
local _scoped=""
if [ -n "${RELEASE:-}" ] && declare -F _release_editions_ >/dev/null; then
_scoped=$(_release_editions_ "${ARCH:-}|${RELEASE}")
fi
if [ -n "${_scoped}" ]; then
echo "${_scoped}"
return 0
fi
local _per_arch="EDITIONS_${ARCH:-}"
if [ -n "${!_per_arch:-}" ]; then
echo "${!_per_arch}"
return 0
fi
echo "${EDITIONS:-}"
}