DistroHopper/templates/manjaro
2026-11-29 05:42:50 +01:00

103 lines
3.4 KiB
Text

# Template file for 'manjaro'
OSNAME="manjaro"
PRETTY="Manjaro"
LOGO=" "
ICON="manjaro.svg"
CATEGORY="Beginner"
BASEDOF="Arch"
HOMEPAGE="https://manjaro.org"
DESCRIPTION="Versatile, free, and open-source Linux operating system designed with a strong focus on safeguarding user privacy and offering extensive control over hardware"
CREDENTIALS="-"
GPG=""
RSS=""
DW=""
function releases_() {
echo xfce gnome plasma cinnamon i3 sway
}
function editions_() {
if [[ "${RELEASE}" == sway ]]; then
echo full
else
echo full minimal
fi
}
function 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}"
}