forked from Shinonome/dots-hyprland
chore: fine-tune installation script. (ref #2566)
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
# COPR repositories list
|
||||||
|
[copr]
|
||||||
|
repos = [
|
||||||
|
"ririko66z/dots-hyprland",
|
||||||
|
"solopasha/hyprland",
|
||||||
|
"deltacopy/darkly",
|
||||||
|
"alternateved/eza",
|
||||||
|
"atim/starship"
|
||||||
|
]
|
||||||
|
|
||||||
# Fedora dependencies list
|
# Fedora dependencies list
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
@@ -17,6 +27,7 @@ packages = [
|
|||||||
"brightnessctl",
|
"brightnessctl",
|
||||||
"ddcutil"
|
"ddcutil"
|
||||||
]
|
]
|
||||||
|
install_opts = ["--setopt=install_weak_deps=False"]
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
[groups.basic]
|
[groups.basic]
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
# This script is meant to be sourced.
|
# This script is meant to be sourced.
|
||||||
# It's not for directly running.
|
# It's not for directly running.
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# CONFIG
|
||||||
|
# -------------------------
|
||||||
|
user_config="${REPO_ROOT}/sdata/dist-fedora/user_data.yaml"
|
||||||
|
rpmbuildroot="${REPO_ROOT}/cache/rpmbuild"
|
||||||
|
deps_data_file="${REPO_ROOT}/sdata/dist-fedora/feddeps.toml"
|
||||||
|
|
||||||
# Initialize the user configuration file
|
# -------------------------
|
||||||
user_config=${REPO_ROOT}/sdata/dist-fedora/user_data.yaml
|
# FUNCTIONS
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
# Recording DNF Transaction ID
|
# Recording DNF Transaction ID
|
||||||
function r() {
|
function r() {
|
||||||
@@ -16,6 +23,36 @@ function r() {
|
|||||||
[ "$original_id" == "$last_id" ] || yq -i ".dnf.transaction_ids += [ $last_id ]" "$user_config" || :
|
[ "$original_id" == "$last_id" ] || yq -i ".dnf.transaction_ids += [ $last_id ]" "$user_config" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Start building and install the missing RPM package locally.
|
||||||
|
function install_RPMS() {
|
||||||
|
local local_specs local_rpms
|
||||||
|
rpmbuildroot="${rpmbuildroot:-${REPO_ROOT}/cache/rpmbuild}"
|
||||||
|
|
||||||
|
x mkdir -p "$rpmbuildroot"/{BUILD,RPMS,SOURCES}
|
||||||
|
x cp -r "${REPO_ROOT}/sdata/dist-fedora/SPECS" "$rpmbuildroot/"
|
||||||
|
|
||||||
|
x cd $rpmbuildroot/SPECS
|
||||||
|
|
||||||
|
mapfile -t -d '' local_specs < <(find "$rpmbuildroot/SPECS" -maxdepth 1 -type f -name "*.spec" -print0)
|
||||||
|
for spec_file in ${local_specs[@]}; do
|
||||||
|
# Download sources
|
||||||
|
x spectool -g -C "$rpmbuildroot/SOURCES" "$spec_file"
|
||||||
|
# Install build dependencies
|
||||||
|
r x sudo dnf builddep -y "$spec_file"
|
||||||
|
# Build the RPM with proper quoting preserved
|
||||||
|
x rpmbuild -bb --define "_topdir $rpmbuildroot" "$spec_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
mapfile -t -d '' local_rpms < <(find "$rpmbuildroot/RPMS" -maxdepth 2 -type f -name '*.rpm' -not -name '*debug*' -print0)
|
||||||
|
echo -e "${STY_BLUE}Next command:${STY_RST} sudo dnf install ${local_rpms[@]} -y"
|
||||||
|
r x sudo dnf install "${local_rpms[@]}" -y
|
||||||
|
x cd ${REPO_ROOT}
|
||||||
|
}
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# MAIN
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
if ! command -v dnf >/dev/null 2>&1; then
|
if ! command -v dnf >/dev/null 2>&1; then
|
||||||
printf "${STY_RED}[$0]: dnf not found, it seems that the system is not Fedora 42 or later distros. Aborting...${STY_RST}\n"
|
printf "${STY_RED}[$0]: dnf not found, it seems that the system is not Fedora 42 or later distros. Aborting...${STY_RST}\n"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -33,61 +70,38 @@ v sudo dnf versionlock delete quickshell-git 2>/dev/null
|
|||||||
# Install yq for parsing config files
|
# Install yq for parsing config files
|
||||||
v sudo dnf install yq -y
|
v sudo dnf install yq -y
|
||||||
|
|
||||||
# Development-tools
|
# Install development tools
|
||||||
r v sudo dnf install @development-tools fedora-packager -y
|
r v sudo dnf install @development-tools fedora-packager -y
|
||||||
|
|
||||||
# COPR repositories
|
# Install COPR repositories
|
||||||
v sudo dnf copr enable ririko66z/dots-hyprland -y
|
copr_repos_json=$(yq -o=j '.copr.repos // []' "$deps_data_file")
|
||||||
v sudo dnf copr enable solopasha/hyprland -y
|
eval "$(jq -r '@sh "copr_repos_array+=(\(.[]))"' <<<"$copr_repos_json")" # Fedora distro contains jq
|
||||||
v sudo dnf copr enable deltacopy/darkly -y
|
for copr in ${copr_repos_array[@]}; do
|
||||||
v sudo dnf copr enable alternateved/eza -y
|
v sudo dnf copr enable "$copr" -y
|
||||||
v sudo dnf copr enable atim/starship -y
|
done
|
||||||
|
|
||||||
# Start building and install the missing RPM package locally.
|
|
||||||
install_RPMS() {
|
|
||||||
rpmbuildroot=${REPO_ROOT}/cache/rpmbuild
|
|
||||||
x mkdir -p $rpmbuildroot/{BUILD,RPMS,SOURCES}
|
|
||||||
x cp -r ${REPO_ROOT}/sdata/dist-fedora/SPECS $rpmbuildroot/
|
|
||||||
x cd $rpmbuildroot/SPECS
|
|
||||||
mapfile -t -d '' local_specs < <(find "$rpmbuildroot/SPECS" -maxdepth 1 -type f -name "*.spec" -print0)
|
|
||||||
for spec_file in ${local_specs[@]}; do
|
|
||||||
x spectool -g -C "$rpmbuildroot/SOURCES" $spec_file
|
|
||||||
r x sudo dnf builddep -y $spec_file
|
|
||||||
x rpmbuild -bb --define "_topdir $rpmbuildroot" $spec_file
|
|
||||||
done
|
|
||||||
mapfile -t -d '' local_rpms < <(find "$rpmbuildroot/RPMS" -maxdepth 2 -type f -name '*.rpm' -not -name '*debug*' -print0)
|
|
||||||
echo -e "${STY_BLUE}Next command:${STY_RST} sudo dnf install ${local_rpms[@]} -y"
|
|
||||||
r x sudo dnf install "${local_rpms[@]}" -y
|
|
||||||
x cd ${REPO_ROOT}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# Build and install locally RPMS
|
||||||
showfun install_RPMS
|
showfun install_RPMS
|
||||||
v install_RPMS
|
v install_RPMS
|
||||||
|
|
||||||
deps_data_file="${REPO_ROOT}/sdata/dist-fedora/feddeps.toml"
|
# Install packages from toml file
|
||||||
deps_data=$(yq -o=j '.' "$deps_data_file")
|
deps_data=$(yq -o=j '.' "$deps_data_file")
|
||||||
echo "Starting to install packages from $deps_data_file ..."
|
echo "Starting to install packages from $deps_data_file ..."
|
||||||
|
|
||||||
while IFS= read -r deps_list_key; do
|
while IFS= read -r deps_list_key; do
|
||||||
|
|
||||||
echo "Installing package list: $deps_list_key"
|
echo "Installing package list: $deps_list_key"
|
||||||
|
|
||||||
install_opts=$(echo $deps_data | yq ".groups.\"$deps_list_key\" | select(has(\"install_opts\")) | .install_opts[]")
|
install_opts=$(echo $deps_data | yq ".groups.\"$deps_list_key\" | select(has(\"install_opts\")) | .install_opts[]")
|
||||||
package_list=$(echo $deps_data | yq ".groups.\"$deps_list_key\".packages | unique | .[]")
|
package_list=$(echo $deps_data | yq ".groups.\"$deps_list_key\".packages | unique | .[]")
|
||||||
|
|
||||||
r v sudo dnf install -y $install_opts $package_list </dev/tty
|
r v sudo dnf install -y $install_opts $package_list </dev/tty
|
||||||
|
|
||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
|
done < <(echo "$deps_data" | yq '.groups | keys[]? | select(length > 0)')
|
||||||
done < <(echo "$deps_data" | yq '
|
|
||||||
.groups |
|
|
||||||
keys[] // [] |
|
|
||||||
select(length > 0)
|
|
||||||
')
|
|
||||||
|
|
||||||
# Add back versionlock at the end
|
# Add back versionlock at the end
|
||||||
v sudo dnf versionlock add quickshell-git
|
v sudo dnf versionlock add quickshell-git
|
||||||
|
|
||||||
echo -e "\n========================================"
|
echo -e "\n========================================"
|
||||||
echo "All installations are complete."
|
echo "All installations are completed."
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user