diff --git a/build_files/base/18-workarounds.sh b/build_files/base/18-workarounds.sh index 9e7fd3f4c9e..fee73812d54 100755 --- a/build_files/base/18-workarounds.sh +++ b/build_files/base/18-workarounds.sh @@ -19,4 +19,8 @@ fi # rpm-ostree override replace https://bodhi.fedoraproject.org/updates/FEDORA-2024-dd2e9fb225 #fi +# Current bluefin systems have the bling.sh and bling.fish in their default locations +mkdir -p /usr/share/ublue-os/bluefin-cli +cp /usr/share/ublue-os/bling/* /usr/share/ublue-os/bluefin-cli + echo "::endgroup::" diff --git a/just/bluefin-system.just b/just/bluefin-system.just index 8bad5ce1b6d..7554529b9f5 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -22,7 +22,7 @@ benchmark: # Configure Bluefin-CLI Terminal Experience with Brew [group('System')] bluefin-cli: - @/usr/libexec/ublue-bling.sh + @/usr/libexec/ublue-bling # alias for toggle-devmode devmode: diff --git a/packages.json b/packages.json index 7188ce2ee2e..f900b40ec50 100644 --- a/packages.json +++ b/packages.json @@ -59,6 +59,7 @@ "tmux", "ublue-motd", "usbmuxd", + "ublue-bling", "wireguard-tools", "xprop", "wl-clipboard", diff --git a/system_files/shared/etc/ublue-os/bling.json b/system_files/shared/etc/ublue-os/bling.json new file mode 100644 index 00000000000..00d314d640a --- /dev/null +++ b/system_files/shared/etc/ublue-os/bling.json @@ -0,0 +1,3 @@ +{ + "bling-cli-name": "bluefin-cli" +} diff --git a/system_files/shared/usr/libexec/ublue-bling.sh b/system_files/shared/usr/libexec/ublue-bling.sh deleted file mode 100755 index 2c0f264b8da..00000000000 --- a/system_files/shared/usr/libexec/ublue-bling.sh +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/bash -#shellcheck disable=SC2154 - -set -eou pipefail - -# Source libujust for colors/ugum -source /usr/lib/ujust/ujust.sh - -# Exit Handling -function Exiting(){ - printf "%s%sExiting...%s\n" "${red}" "${bold}" "${normal}" - printf "Rerun script with %s%sujust bluefin-cli%s\n" "${blue}" "${bold}" "${normal}" - exit 0 -} - -# Trap function -function ctrl_c(){ - printf "\nSignal SIGINT caught\n" - Exiting -} - -# Brew Bundle Install -function brew-bundle(){ -echo 'Installing bling from Homebrew 🍻🍻🍻' -brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile --no-lock -} - -# Check if bling is already sourced -function check-bling() { -shell="$1" -if [[ "${shell}" == "fish" ]]; then - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.fish" \ - "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" \ - | grep -Eo '^[^:]+') - if [[ -n "${line}" ]]; then - return 1; - fi - return 0; -elif [[ "${shell}" == "zsh" ]]; then - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.sh" \ - "${ZDOTDIR:-$HOME}/.zshrc" \ - | grep -Eo '^[^:]+') - if [[ -n "${line}" ]]; then - return 1; - fi - return 0; -elif [[ "${shell}" == "bash" ]]; then - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.sh" \ - "${HOME}/.bashrc" \ - | grep -Eo '^[^:]+') - if [[ -n "${line}" ]]; then - return 1; - fi - return 0; -else - echo 'Unknown Shell ... You are on your own' - exit 1; -fi -} - -# Add Bling -function add-bling(){ -shell="$1" -if ! brew-bundle; then - Exiting -fi -echo 'Setting up your Shell 🐚🐚🐚' -if [[ "${shell}" == "fish" ]]; then - echo 'Adding bling to your config.fish 🐟🐟🐟' - cat<<-EOF >> "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" -### bling.fish source start -test -f /usr/share/ublue-os/bluefin-cli/bling.fish && source /usr/share/ublue-os/bluefin-cli/bling.fish -### bling.fish source end -EOF -elif [[ "${shell}" == "zsh" ]]; then - echo 'Adding bling to your .zshrc 💤💤💤' - cat<<-EOF >> "${ZDOTDIR:-$HOME}/.zshrc" -### bling.sh source start -test -f /usr/share/ublue-os/bluefin-cli/bling.sh && source /usr/share/ublue-os/bluefin-cli/bling.sh -### bling.sh source end -EOF -elif [[ "${shell}" == "bash" ]]; then - echo 'Adding bling to your .bashrc 💥💥💥' - cat<<-EOF >> "${HOME}/.bashrc" -### bling.sh source start -test -f /usr/share/ublue-os/bluefin-cli/bling.sh && source /usr/share/ublue-os/bluefin-cli/bling.sh -### bling.sh source end -EOF -else - echo 'Unknown Shell ... You are on your own' -fi -} - -# Remove bling, handle if old method -function remove-bling(){ -shell="$1" -if [[ "${shell}" == "fish" ]]; then - sed -i '/### bling.fish source start/,/### bling.fish source end/d' \ - "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" \ - || \ - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.fish" \ - "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" \ - | grep -Eo '^[^:]+') && sed -i "${line}"d \ - "${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish" -elif [[ "${shell}" == "zsh" ]]; then - sed -i '/### bling.sh source start/,/### bling.sh source end/d' \ - "${ZDOTDIR:-$HOME}/.zshrc" \ - || \ - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.sh" \ - "${ZDOTDIR:-$HOME}/.zshrc" \ - | grep -Eo '^[^:]+') && sed -i "${line}"d \ - "${ZDOTDIR:-$HOME}/.zshrc" -elif [[ "${shell}" == "bash" ]]; then - sed -i '/### bling.sh source start/,/### bling.sh source end/d' \ - "${HOME}/.bashrc" \ - || \ - line=$(grep -n "source /usr/share/ublue-os/bluefin-cli/bling.sh" \ - "${HOME}/.bashrc" \ - | grep -Eo '^[^:]+') && sed -i "${line}"d \ - "${HOME}/.bashrc" -fi -} - -# Main function. -function main(){ - -# Get Shell -shell=$(basename "$SHELL") -reentry="$1" -clear -if [[ -n "${reentry:-}" ]]; then - printf "%s%s%s\n\n" "${bold}" "$reentry" "$normal" -fi - -# Check if bling is enabled and display -printf "Shell:\t%s%s%s%s\n" "${green}" "${bold}" "${shell}" "${normal}" -if ! check-bling "${shell}"; then - printf "Bling:\t%s%sEnabled%s\n" "${green}" "${bold}" "${normal}" -else - printf "Bling:\t%s%sDisabled%s\n" "${red}" "${bold}" "${normal}" -fi - -# ugum enable/disable -CHOICE=$(Choose enable disable cancel) - -# Enable/Disable. Recurse if bad option. -if [[ "${CHOICE}" == "enable" ]]; then - if check-bling "${shell}"; then - trap ctrl_c SIGINT - add-bling "${shell}" - printf "%s%sInstallation Complete%s ... please close and reopen your terminal!" "${green}" "${bold}" "${normal}" - else - main "Bling is already configured ..." - fi -elif [[ "${CHOICE}" == "disable" ]]; then - if check-bling "${shell}"; then - main "Bling is not yet configured ..." - else - remove-bling "${shell}" - trap ctrl_c SIGINT - printf "%s%sBling Removed%s ... please close and reopen your terminal\n" "${red}" "${bold}" "${normal}" - fi -else - Exiting -fi -} - -# Entrypoint -main "" diff --git a/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.fish b/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.fish deleted file mode 100644 index a9fa7d47f62..00000000000 --- a/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.fish +++ /dev/null @@ -1,22 +0,0 @@ -# ls aliases -if [ "$(command -v eza)" ] - alias ll='eza -l --icons=auto --group-directories-first' - alias l.='eza -d .*' - alias ls='eza' - alias l1='eza -1' -end - -# ugrep for grep -if [ "$(command -v ug)" ] - alias grep='ug' - alias egrep='ug -E' - alias fgrep='ug -F' - alias xzgrep='ug -z' - alias xzegrep='ug -zE' - alias xzfgrep='ug -zF' -end - -if status is-interactive - [ "$(command -v atuin)" ] && eval "$(atuin init fish)" - [ "$(command -v zoxide)" ] && eval "$(zoxide init fish)" -end diff --git a/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.sh b/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.sh deleted file mode 100644 index d2b7f54d4db..00000000000 --- a/system_files/shared/usr/share/ublue-os/bluefin-cli/bling.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env sh - -# Check if bling has already been sourced so that we dont break atuin. https://github.com/atuinsh/atuin/issues/380#issuecomment-1594014644 -[ "${BLING_SOURCED:-0}" -eq 1 ] && return -BLING_SOURCED=1 - -# ls aliases -if [ "$(command -v eza)" ]; then - alias ll='eza -l --icons=auto --group-directories-first' - alias l.='eza -d .*' - alias ls='eza' - alias l1='eza -1' -fi - -# ugrep for grep -if [ "$(command -v ug)" ]; then - alias grep='ug' - alias egrep='ug -E' - alias fgrep='ug -F' - alias xzgrep='ug -z' - alias xzegrep='ug -zE' - alias xzfgrep='ug -zF' -fi - -HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-/home/linuxbrew/.linuxbrew}" - -if [ "$(basename "$SHELL")" = "bash" ]; then - #shellcheck disable=SC1091 - [ -f "${HOMEBREW_PREFIX}"/etc/profile.d/bash-preexec.sh ] && . "${HOMEBREW_PREFIX}"/etc/profile.d/bash-preexec.sh - [ "$(command -v atuin)" ] && eval "$(atuin init bash)" - [ "$(command -v zoxide)" ] && eval "$(zoxide init bash)" -elif [ "$(basename "$SHELL")" = "zsh" ]; then - [ "$(command -v atuin)" ] && eval "$(atuin init zsh)" - [ "$(command -v zoxide)" ] && eval "$(zoxide init zsh)" -fi