Files
davidandClaude Opus 5.5 a102e6fe0b
shellcheck / shellcheck (push) Successful in 11s
Check the machine before installing, and keep old shells' mise working
install.sh now stops early, with a clear message, if this isn't 64-bit
Arch, it's run as root, there's no internet, or sudo doesn't work.
system/preflight.sh then asks before going on with too little disk space
or / not on btrfs, and offers to switch another login screen to GDM and
PulseAudio to PipeWire. Keeping another login screen puts GDM in
services-off, so install and update stop failing to enable it; a
migration does the same on existing machines. It says nothing when all
is well, as refresh runs install.sh again.

Intel GPUs also get intel-media-driver for hardware video decoding, with
a migration for existing machines.

The mise migration links ~/.local/bin/mise to /usr/bin/mise instead of
deleting it, so shells opened before the update don't print an error at
every prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:25:46 -06:00

41 lines
1.8 KiB
Bash

#!/bin/bash
# mise now comes from pacman, and shell/bashrc activates it, so replace the copy
# mise.run installed in ~/.local/bin with a link to it, and remove the line
# mise.run added to ~/.bashrc. Ruby and Rails are no longer installed for
# everyone, only with configure languages: machines that have them keep them,
# and update keeps Rails on new Rubies.
LANGUAGES_CONF="$HOME/.config/coredesktop/languages"
DEFAULT_GEMS="$HOME/.default-gems"
# 10-pacman.sh installs mise from packages.conf before migrations run
[ -x /usr/bin/mise ] || { echo "mise isn't installed from pacman yet."; exit 1; }
if [ -f ~/.bashrc ] && grep -qE '\.local/bin/mise activate' ~/.bashrc; then
tmp="$(mktemp ~/.bashrc.XXXXXX)" || exit 1
# grep -v exits 1 when that line was all there was, which is fine
grep -vE '\.local/bin/mise activate' ~/.bashrc > "$tmp"
(( $? <= 1 )) && cat "$tmp" > ~/.bashrc
status=$?
rm -f "$tmp"
[ $status -eq 0 ] || exit 1
fi
# A link, not nothing: shells opened before this update still run the old
# copy's path before every prompt, and would print an error until closed
ln -sfn /usr/bin/mise ~/.local/bin/mise || exit 1
# Ruby that CoreDesktop installed: count it as chosen with configure languages.
# From home, so a project's mise.toml in the current directory doesn't count.
cd "$HOME" || exit 1
if /usr/bin/mise ls --global --quiet 2> /dev/null | grep -q '^ruby '; then
mkdir -p "$(dirname "$LANGUAGES_CONF")" || exit 1
grep -qsx rails "$LANGUAGES_CONF" || echo rails >> "$LANGUAGES_CONF"
for gem in bundler rails; do
grep -qsx "$gem" "$DEFAULT_GEMS" || echo "$gem" >> "$DEFAULT_GEMS"
done
# update used to move to a new Ruby without Rails
echo "Making sure Rails is installed..."
MISE_YES=1 /usr/bin/mise exec -- gem install --conservative bundler rails || exit 1
fi
exit 0