Initial Commit.

This commit is contained in:
2026-04-07 16:39:37 -04:00
parent af4983865f
commit cc5c8cbf6a
6 changed files with 856 additions and 15 deletions
+128
View File
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
<mailto:olivia.a.brooks77@gmail.com>.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the
[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1,
available at
<https://www.contributor-covenant.org/version/2/1/code_of_conduct/>.
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/inclusion).
For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq/>. Translations are available at
<https://www.contributor-covenant.org/translations/>.
+4 -13
View File
@@ -1,18 +1,9 @@
MIT License
Copyright (c) 2026 Cutieguwu
Copyright (c) 2026 Olivia Brooks
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+41 -2
View File
@@ -1,3 +1,42 @@
# manjaro2archcachy
# Manjaro2ArchCachy
Script for migrating Manjaro systems to Arch and CachyOS hybrids with some Manjaro orphans.
![Transware](https://pride-badges.pony.workers.dev/static/v1?label=Transware&labelColor=%23555&stripeWidth=6&stripeColors=5BCEFA%2CF5A9B8%2CFFFFFF%2CF5A9B8%2C5BCEFA)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
## Prelude
Even before Manjaro the Project sought to revive the Manjaro OS, I was
interested in running the CachyOS kernel. Eventually, because that was stable,
I sought to migrate my systems to hybrids to avoid the pains of a
tedious migration off Manjaro.
For what it's worth, I have been daily-driving Manjaro for the last five years.
I have no issues with Manjaro the Project's 2.0 Manifesto. This is just a
precaution to avoid being caught up in a potential collapse, and give some
people an easier out if they so wish.
## Warning
I MAKE NO CLAIMS ABOUT SECURITY.
This script will, without a doubt, end up leaving orphaned Manjaro packages on
the system. I cannot account for them all.
PRs for resolving this are appreciated!
## Nvidia
This script does not check for Nvidia graphics on the system (at least not yet).
My remaining systems do not possess Nvidia cards, so I don't need to figure out
detection for this.
If you do have an Nvidia card, please see the CachyOS documentation for more
information.
Newer cards should only need to run:
```bash
sudo pacman -R nvidia-dkms
sudo pacman -S linux-cachyos{-kernelVariant}-nvidia-open
```
+243
View File
@@ -0,0 +1,243 @@
#!/usr/bin/bash
# Yes, this is a disaster of a bash script.
# I'm really hacking things together here.
# Fail on command failure.
# This acts funky, and prevents failure on reserved words like:
#
# "The -e setting shall be ignored when executing the compound list following the
# while, until, if, or elif reserved word, a pipeline beginning with the ! reserved word,
# or any command of an AND-OR list other than the last." - set man page
#set -e
RED='\e[31m'
GREEN='\e[32m'
assert() {
if ! $1; then
echo "Script depends on $2 to function, please resolve manually."
fi
# Yes, this is always true, but anyway.
return $1
}
is_installed() {
return ! which "$1" > /dev/null
}
run_unprivileged() {
sudo -u "$USERNAME" "$@"
}
log() {
if "$1"; then
echo -e "$2...${GREEN}yes $3"
else
echo -e "$2...${RED}no"
fi
}
# Checks
[ $(id -u) = 0 ]
if ! $?; then
echo "Script must be run with elevated permissions."
exit 1
fi
# As much as I highly doubt that pacman, curl, lspci, and mhwd-kernel will be missing,
# might as well do the easy check.
#
# Also, if sudo cannot be called, the user might be using doas, in which case they'll need to fix
# their aliases or patch the privilege drop for run_unprivileged.
SUDO=$(is_installed sudo)
PACMAN=$(is_installed pacman)
YAY=$(is_installed yay)
CURL=$(is_installed curl)
LSPCI=$(is_installed lspci)
REFLECTOR=$(is_installed reflector)
MHWD_KERNEL=$(is_installed mhwd-kernel)
DKMS=$(is_installed dkms)
log $(assert $SUDO "sudo") "sudo"
log $(assert $PACMAN "pacman") "pacman"
log $YAY "yay"
log $CURL "curl"
log $(assert $LSPCI "lspci") "lspci"
log $REFLECTOR "reflector"
log $(assert $MHWD_KERNEL "mhwd-kernel") "mhwd-kernel"
log $DKMS "dkms"
pacman -Qs pamac
PAMAC=$?
USERNAME=$(logname)
[ $#USERNAME > 0]
log $? "unprivileged_user" "$USERNAME"
[ $(lspci | grep "VGA" | grep "nvidia") > 0 ]
NVIDIA_GPU=$?
log $NVIDIA_GPU "nvidia_gpu"
# Identify installed Manjaro kernels
mhwd_dump=$(mhwd-kernel -li | grep "linux")
re="linux\d+"
ACTIVE_KERNEL=$(echo "$mhwd_dump" | grep "running" | grep -Po "$re" )
ALTERNATE_KERNELS=$(echo "$mhwd_dump" | grep -Po "$re" | grep -v "$ACTIVE_KERNEL")
[ $#ACTIVE_KERNEL > 0]
log $? "active_kernel" "$ACTIVE_KERNEL"
[ $#ALTERNATE_KERNELS > 0 ]
log $? "alternate_kernels"
# no dkms, no propagation
# dkms, no nvidia, guaranteed propagation
# dkms, w/ nvidia, possible propagation
PROPAGATE_DKMS=$DKMS
if $DKMS && $NVIDIA_GPU; then
[ $(dkms status | grep -v "nvidia") > 0 ]
PROPAGATE_DKMS=$?
fi
log "$PROPAGATE_DKMS" "propagate_dkms"
# Prep
pacman -Syy
if $PAMAC; then
echo "Pamac is installed, removing..."
# TODO: Uninstall pamac if present
fi
if ! $YAY; then
echo "Yay is not installed, calling: pacman -S yay"
pacman -S yay
assert $(is_installed yay) "yay"
run_unprivileged yay -Syy
fi
if ! $CURL; then
echo "Curl is not installed, calling: pacman -S curl"
pacman -S curl
assert $(is_installed curl) "curl"
fi
if ! $REFLECTOR; then
echo "Reflector is not installed, calling: yay -S reflector"
run_unprivileged yay -S reflector
assert $(is_installed reflector) "reflector"
fi
# Configure new mirrorlists
# CachyOS
# See: https://wiki.cachyos.org/features/optimized_repos/#adding-our-repositories-to-an-existing-arch-linux-install
cd $(mktemp -d)
curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz
tar xvf cachyos-repo.tar.xz
cd cachyos-repo
# Just in case, ensure the script can be executed.
if [[ ! -x "cachyos-repo.sh" ]]; then
chmod +x cachyos-repo.sh
fi
./cachyos-repo.sh
# Arch
# Backup the old Manjaro mirrorlist
DEFAULT_MIRRORLIST='/etc/pacman.d/mirrorlist'
mv $DEFAULT_MIRRORLIST "$DEFAULT_MIRRORLIST.bak"
curl -o "$DEFAULT_MIRRORLIST" https://archlinux.org/mirrorlist/all/
reflector\
--fastest 32\
--protocol https\
--sort rate\
--country CA,NZ,DE,NL,PL,SE\
--save /etc/pacman.d/mirrorlist
pacman -Syy
# Install new kernel
DEFAULT_KERNEL="linux-cachyos"
PROPAGATE_MANJARO="Keep all currently installed Manjaro kernels"
# yes, they're hard-coded. For now at least.
KNOWN_KERNELS=(
"$PROPAGATE_MANJARO",
"linux",
"linux-lts",
"linux-hardened",
"linux-rt",
"linux-cachyos",
"linux-cachyos-lts",
"linux-cachyos-hardened",
"linux-cachyos-bore",
"linux-cachyos-eevdf",
"linux-cachyos-bmq",
"linux-cachyos-deckify",
"linux-cachyos-rc",
"linux-cachyos-rt-bore",
"linux-cachyos-server",
"linux-zen"
#"linux-cachyos-cacule",
#"linux-cachyos-debug",
#"linux-cachyos-gcc",
)
echo "INSTALL NEW KERNEL"
echo "Warning: All options except 0 will remove all Manjaro kernels except the active one."
echo " If you have no additional kernels installed, then this will do nothing."
echo "Note: Multiple options can be chosen with comma separation."
echo
# List KNOWN_KERNELS
for idx in "${!KNOWN_KERNELS[@]}"; do
printf "%s\t%s\n" "$idx" "${KNOWN_KERNELS[$idx]}"
done
# Print default kernel selection
for idx in "${!KNOWN_KERNELS[@]}"; do
if [[ "${KNOWN_KERNELS[$idx]}" == "$DEFAULT_KERNEL" ]]; then
printf "Default: %s (%s)" "$idx" "$DEFAULT_KERNEL"
kernels="$idx"
fi
done
echo -n "Kernel(s): "
read -r tmp
if [[ ${#tmp} > 0 ]]; then
# Credit to bgoldst on StackOverflow for this solution.
# https://stackoverflow.com/questions/10586153/how-to-split-a-string-into-an-array-in-bash
kernels=$(readarray -td, a <<< "$tmp,"; unset 'a[-1]'; declare -p a)
fi
if [[ $ALTERNATE_KERNELS > 0 ]]; then
# Determine if the user wants to maintain the installed kernel(s).
for idx in "${kernels}"; do
if [[ "${KNOWN_KERNELS[$idx]}" == "$PROPAGATE_MANJARO" ]]; then
run_unprivileged yay -R "${ALTERNATE_KERNELS[@]}"
break
fi
done
fi
# TODO: Install kernels
# TODO: dkms module propagation
# TODO: Remove DKMS if only present for nvidia-dkms [ ! $PROPAGATE_DKMS ]
# TODO: Kill Orphans
+227
View File
@@ -0,0 +1,227 @@
RED="\e[31m"
GREEN="\e[32m"
DEFAULT_MIRRORLIST="/etc/pacman.d/mirrorlist"
DEFAULT_KERNEL="linux-cachyos"
PROPAGATE_MANJARO="Keep all currently installed Manjaro kernels"
# yes, they're hard-coded. For now at least.
KNOWN_KERNELS=(
"$PROPAGATE_MANJARO",
"linux",
"linux-lts",
"linux-hardened",
"linux-rt",
"linux-cachyos",
"linux-cachyos-lts",
"linux-cachyos-hardened",
"linux-cachyos-bore",
"linux-cachyos-eevdf",
"linux-cachyos-bmq",
"linux-cachyos-deckify",
"linux-cachyos-rc",
"linux-cachyos-rt-bore",
"linux-cachyos-server",
"linux-zen"
#"linux-cachyos-cacule",
#"linux-cachyos-debug",
#"linux-cachyos-gcc",
)
assert() {
if ! $1; then
echo "Script depends on $2 to function, please resolve manually."
fi
# Yes, this is always true, but anyway.
return $1
}
is_installed() {
return ! which "$1" > /dev/null
}
run_unprivileged() {
sudo -u "$USERNAME" "$@"
}
log() {
if "$1"; then
echo -e "$2...${GREEN}yes $3"
else
echo -e "$2...${RED}no"
fi
}
# Credit to NaN on StackOverflow for this solution.
# https://stackoverflow.com/questions/29436275/how-to-prompt-for-yes-or-no-in-bash
prompt_bool() {
if $2; then
options="[Y/n]"
default="y"
else
options="[y/N]"
default="n"
fi
echo -n "$1 $options"
read -r tmp
tmp=${tmp:-${default}}
if [[ "$tmp" =~ ^[yY]$ ]]; then
return true
else
return false
fi
}
# CHECKS
if ! $?; then
echo "Script must be run with elevated permissions."
exit 1
fi
refresh_checks() {
[ $(id -u) = 0 ]
ROOT_PERMS=$?
log $ROOT_PERMS "root_perms"
LSPCI=$(is_installed lspci)
log $LSPCI "lspci"
PACMAN=$(is_installed pacman)
log $PACMAN "pacman"
MHWD_KERNEL=$(is_installed mhwd-kernel)
log $MHWD_KERNEL "mhwd-kernel"
SUDO=$(is_installed sudo)
log $SUDO "sudo"
CURL=$(is_installed curl)
log $CURL "curl"
REFLECTOR=$(is_installed reflector)
log $REFLECTOR "reflector"
YAY=$(is_installed yay)
log $YAY "yay"
USERNAME=$(logname)
log $? "unprivileged_user" $USERNAME
# Identify installed Manjaro kernels
re="linux\d+"
mhwd_dump=$(mhwd-kernel -li | grep "linux")
ACTIVE_KERNEL=$(echo "$mhwd_dump" | grep "running" | grep -Po "$re" )
[ ${#ACTIVE_KERNEL} > 0 ]
log $? "active_kernel" $ACTIVE_KERNEL
ALTERNATE_KERNELS=$(echo "$mhwd_dump" | grep -Po "$re" | grep -v "$ACTIVE_KERNEL")
[ ${#ALTERNATE_KERNELS} > 0 ]
log $? "alternate_kernels"
}
refresh_checks
assert $ROOT_PERMS "elevated permissions"
assert $LSPCI "lspci"
assert $PACMAN "pacman"
assert $MHWD_KERNEL "mhwd-kernel"
assert $SUDO "sudo"
# Attempt to recover from failing checks
deps=()
if ! $YAY; then
deps+=("yay")
fi
if ! $CURL; then
deps+=("curl")
fi
if [[ ${#deps} > 0 ]]; then
pacman -Syy "${deps[@]}"
fi
if ! $REFLECTOR; then
run_unprivileged yay -Syy "${deps[@]}"
fi
refresh_checks
assert $CURL "curl"
assert $REFLECTOR "reflector"
# OPTIONAL OPERATIONS
prompt_bool "Remove all kernels (excepting active)?" true
if $?; then
# Remove alternate kernels
# mhwd?
fi
# REPOS
# Install CachyOS Repos
# See: https://wiki.cachyos.org/features/optimized_repos/#adding-our-repositories-to-an-existing-arch-linux-install
cd $(mktemp -d)
curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz
tar xvf cachyos-repo.tar.xz
cd cachyos-repo
# Just in case, ensure the script can be executed.
if [[ ! -x "cachyos-repo.sh" ]]; then
chmod +x cachyos-repo.sh
fi
./cachyos-repo.sh
# Backup Manjaro Repos
mv "$DEFAULT_MIRRORLIST" "$DEFAULT_MIRRORLIST.bak"
# Install Arch Repos
curl -o "$DEFAULT_MIRRORLIST" "https://archlinux.org/mirrorlist/all/"
reflector\
--fastest "32"\
--protocol "https"\
--sort "rate"\
--country "CA,NZ,DE,NL,PL,SE"\
--save "$DEFAULT_MIRRORLIST"
pacman -Syy
if ! is_installed chwd; then
pacman -S chwd
assert $(is_installed chwd) "chwd"
fi
# INSTALL NEW KERNEL(S)
# List available kernels
for idx in "${!KNOWN_KERNELS[@]}"; do
printf "%s\t%s\n" "$idx" "${KNOWN_KERNELS[$idx]}"
done
echo -n "Kernel(s): "
read -r tmp
if [[ ${#tmp} > 0 ]]; then
# Credit to bgoldst on StackOverflow for this solution.
# https://stackoverflow.com/questions/10586153/how-to-split-a-string-into-an-array-in-bash
kernels=$(readarray -td, a <<< "$tmp,"; unset 'a[-1]'; declare -p a)
else
kernels="$DEFAULT_KERNEL"
fi
# TODO: Install kernels
# Handle propagations
# DKMS propagations
# Nvidia drivers migration from DKMS to -nvidia-open
# Arch and Zen kernels?
chwd --autoconfigure
# Kill Orphans
# DKMS && !PROPAGATE_DKMS, but maybe CHWD will remove the need for this???
# MHWD
# Pamac
+213
View File
@@ -0,0 +1,213 @@
#!/usr/bin/bash
DEFAULT_MIRRORLIST="/etc/pacman.d/mirrorlist"
DEFAULT_KERNEL="linux-cachyos"
PROPAGATE_MANJARO="Keep all currently installed Manjaro kernels"
# yes, they're hard-coded. For now at least.
KNOWN_KERNELS=(
"$PROPAGATE_MANJARO"
"linux"
"linux-lts"
"linux-hardened"
"linux-rt"
"linux-cachyos"
"linux-cachyos-lts"
"linux-cachyos-hardened"
"linux-cachyos-bore"
"linux-cachyos-eevdf"
"linux-cachyos-bmq"
"linux-cachyos-deckify"
"linux-cachyos-rc"
"linux-cachyos-rt-bore"
"linux-cachyos-server"
"linux-zen"
#"linux-cachyos-cacule"
#"linux-cachyos-debug"
#"linux-cachyos-gcc"
)
RED="\e[31m"
GREEN="\e[32m"
ERASE='\033[0m'
run_unprivileged() {
sudo -u "$USERNAME" "$@"
}
is_installed() {
which "$1" > /dev/null
[ $? -eq 0 ]
return $?
}
assert() {
if ! $1; then
echo "Script depends on $2 to function, please resolve manually."
fi
# Yes, this is always true, but anyway.
return $1
}
# Credit to NaN on StackOverflow for this solution.
# https://stackoverflow.com/questions/29436275/how-to-prompt-for-yes-or-no-in-bash
prompt_bool() {
if $2; then
options="[Y/n]"
default="y"
else
options="[y/N]"
default="n"
fi
echo -ne "$1 $options: "
read -r tmp
tmp=${tmp:-${default}}
[[ "$tmp" =~ ^[yY]$ ]]
return $?
}
log() {
echo -e "${GREEN}[INFO] $1$ERASE"
}
if [[ $(id -u) > 0 ]]; then
echo -e "${RED}[ERROR] Script requires elevated permissions.${ERASE}"
exit 1
fi
log "Checking for reflector..."
if ! is_installed reflector; then
pacman -S yay
assert $(is_installed yay) "yay"
run_unprivileged yay -S reflector
assert $(is_installed reflector) "reflector"
fi
# REPOS
# Install CachyOS Repos
# See: https://wiki.cachyos.org/features/optimized_repos/#adding-our-repositories-to-an-existing-arch-linux-install
log "Installing CachyOS repos..."
cd $(mktemp -d)
curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz
tar xvf cachyos-repo.tar.xz
cd cachyos-repo
# Just in case, ensure the script can be executed.
if [[ ! -x "cachyos-repo.sh" ]]; then
chmod +x cachyos-repo.sh
fi
./cachyos-repo.sh
# Backup Manjaro Repos
log "Backing up Manjaro mirrorlist..."
mv "$DEFAULT_MIRRORLIST" "$DEFAULT_MIRRORLIST.bak"
# Install Arch Repos
log "Installing Arch Linux repos..."
curl -o "$DEFAULT_MIRRORLIST" "https://archlinux.org/mirrorlist/all/"
log "Refreshing Arch mirrors..."
reflector\
--fastest "32"\
--protocol "https"\
--sort "rate"\
--save "$DEFAULT_MIRRORLIST"
pacman -Syy
log "Checking for chwd..."
if ! is_installed chwd; then
pacman -Sdd chwd
assert $(is_installed chwd) "chwd"
fi
# INSTALL NEW KERNEL(S)
log "Installing new kernel(s)..."
# List available kernels
for idx in "${!KNOWN_KERNELS[@]}"; do
printf "%s\t%s\n" "$idx" "${KNOWN_KERNELS[$idx]}"
done
echo
echo -n "Kernel(s): "
read -r tmp
if [[ ${#tmp} > 0 ]]; then
# Credit to bgoldst on StackOverflow for this solution.
# https://stackoverflow.com/questions/10586153/how-to-split-a-string-into-an-array-in-bash
readarray -td, kernels <<< "$tmp,"
unset 'kernels[-1]'
declare -p kernels
tmp=()
for idx in "${kernels[@]}"; do
if [[ $idx != 0 ]]; then
tmp+=("${KNOWN_KERNELS[$idx]}")
fi
done
kernels=(${tmp[@]})
else
kernels="$DEFAULT_KERNEL"
fi
# TODO: Install kernels
log "Installing desired kernels..."
if [[ ${#kernels} != 0 ]]; then
pacman -S --noconfirm ${kernels[@]}
else
echo "No new kernels, skipping."
fi
log "Running additional installs, package migrations, and orphan removals..."
deps_install=(
"protonup-qt"
"proton-cachyos-slr"
)
deps_remove=(
"manjaro-release"
"mhwd"
)
log "Checking for KDE..."
if [[ $(echo $XDG_CURRENT_DESKTOP | grep -i "kde") ]]; then
prompt_bool "Replace sddm with plasma-login-manager?" true
if [[ $? ]]; then
deps_install+=("plasma-login-manager")
deps_remove+=("sddm")
deps_remove+=("sddm-kcm")
fi
fi
log "Checking for Pamac..."
if [[ $(is_installed pamac-manager) || $(is_installed pamac) ]]; then
prompt_bool "Uninstall Pamac?" true
if [[ $? ]]; then
# TODO: Uninstall pamac deps.
echo -n
fi
fi
log "Removing old packages and Manjaro orphans..."
pacman -R ${deps_remove[@]}
log "Fetching all system packages to replace with CachyOS+Arch packages..."
# Credit to https://insrt.uk/post/pacman-reinstall for this solution.
deps_install+=($(comm -12 <(pacman -Slq | sort -u) <(pacman -Qq | sort -u)))
log "Installing new packages..."
pacman -Sdd ${deps_install[@]}
log "Done."
echo "Quick reminder: Be prepared to fix things!"
echo "Many orphaned packages will still exist on the system, and should be"
echo "removed to reduce the system's attack surface. This may also prevent"
echo "issues down the line due to incompatibilities between CachyOS+Arch and"
echo "various Manjaro hacks."
echo
echo "It is recommended to install Octopi and look for packages prefixed with"
echo "'manjaro-' and remove them. Also check packages which have fallen back"
echo "to being sourced from the AUR."