-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(just): cleanup and standardization of just recipes #1003
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2aa623d
fix(just): correctly say devmode is disabled
HikariKnight 3155709
fix(just): do not attempt to run "just devmode" when echoing
HikariKnight f7fff4e
Merge branch 'main' into just-reorg
HikariKnight 6b7dca6
Merge branch 'main' into just-reorg
HikariKnight feb12ab
feat(just): merge shell recipes into 1 recipe
HikariKnight cc80513
feat(just): add standardization guide to header
HikariKnight abb03c7
chore(just): remove empty lines in recipes to fix justfile highlighter
HikariKnight a82ec25
chore(just): move applications into their own file
HikariKnight 0305a7d
feat(just): convert cockpit recipe into a setup recipe
HikariKnight b44232f
chore(just): move jetbrains toolbox to apps justfile
HikariKnight a2be83f
chore(just): move touch recipe to apps justfile
HikariKnight b23edee
chore(just): move atuin to apps justfile
HikariKnight fc34033
chore(just): move tool recipes to the tools justfile
HikariKnight ca922bd
chore(just): move incus to apps justfile
HikariKnight 8f29b82
chore(just): update remaining recipes to use standardized verbs
HikariKnight 8883aa1
chore(just): rename custom.just to bluefin-system.just
HikariKnight 3e950ea
feat(just): add headers to show the origin file
HikariKnight 32a8f7e
Merge branch 'main' into just-reorg
HikariKnight 2334a40
feat(just): handle shell selection better when configuring the user s…
HikariKnight 6ade792
Merge branch 'main' into just-reorg
castrojo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# vim: set ft=make : | ||
######################## | ||
### bluefin-apps.just | ||
######################## | ||
## Standardized verbs | ||
# configure- = configure something that is pre-installed on the image | ||
# install- = install something, no uninstall or configuration provided | ||
# setup- = install something and also provide configuration and/or uninstallation options | ||
# toggle- = turn something on/off, logic can be automatic or manual selection | ||
# fix- = apply fix/patch/workaround for something | ||
# foo = no verb is used for shortcuts or something deemed important enough to use a super memorable name | ||
|
||
alias brew := install-brew | ||
|
||
# Install Homebrew | https://brew.sh | ||
install-brew: | ||
#!/usr/bin/env bash | ||
source /usr/lib/ujust/ujust.sh | ||
if [[ ! -f "/var/home/linuxbrew/.linuxbrew/bin" || ! -x "/var/home/linuxbrew/.linuxbrew/bin/brew" ]]; then | ||
echo "${b}Brew Installation${n}" | ||
echo "Please ${b}IGNORE${n} everything the installer tells you to do at the end" | ||
echo "We have already done it for you! You just need to close and re-open the terminal after installation" | ||
echo "Do you understand?" | ||
echo "Please type in \"YES I UNDERSTAND\" and press enter" | ||
read ACCEPT | ||
if [ "$ACCEPT" == "YES I UNDERSTAND" ]; then | ||
/usr/bin/bash -c '/usr/libexec/brew-install' | ||
else | ||
echo "Capitalization matters when you type \"YES I UNDERSTAND\"" | ||
fi | ||
fi | ||
# if /etc/profile.d/brew.sh already exists, replace it with /usr/etc/profile.d/brew.sh | ||
if [ -f /etc/profile.d/brew.sh ]; then | ||
if [ -f /usr/etc/profile.d/brew.sh ]; then | ||
sudo cp /usr/etc/profile.d/brew.sh /etc/profile.d/brew.sh | ||
fi | ||
fi | ||
|
||
alias brew-fleek := install-brew-fleek | ||
|
||
# Install "fleek" set of packages for brew | none, low, default, high | ||
install-brew-fleek level="high": | ||
#!/usr/bin/env bash | ||
curl --proto '=https' --tlsv1.2 -sSf -L https://brew.getfleek.dev/s/fleek | bash -s -- {{ level }} | ||
|
||
alias cockpit := setup-cockpit | ||
|
||
# Enable Cockpit for web-based system management | https://cockpit-project.org/ | ||
setup-cockpit ACTION="": | ||
#!/usr/bin/env bash | ||
source /usr/lib/ujust/ujust.sh | ||
COCKPIT_SERVICE_STATUS="$(systemctl is-enabled cockpit.service)" | ||
if [ "$COCKPIT_SERVICE_STATUS" == "enabled" ]; then | ||
COCKPIT_SERVICE_STATUS="${green}${b}Enabled${n}" | ||
elif [ "$COCKPIT_SERVICE_STATUS" == "disabled" ]; then | ||
COCKPIT_SERVICE_STATUS="${red}${b}Disabled${n}" | ||
else | ||
COCKPIT_SERVICE_STATUS="${invert}${b}Not Installed${n}" | ||
fi | ||
OPTION={{ ACTION }} | ||
if [ "$OPTION" == "help" ]; then | ||
echo "Usage: ujust setup-cockpit <option>" | ||
echo " <option>: Specify the quick option to skip the prompt" | ||
echo " Use 'install' to select Install Cockpit" | ||
echo " Use 'enable' to select Enable Cockpit" | ||
echo " Use 'disable' to select Disable Cockpit" | ||
exit 0 | ||
elif [ "$OPTION" == "" ]; then | ||
echo "${bold}Cockpit Setup${normal}" | ||
echo "Cockpit service is currently: $COCKPIT_SERVICE_STATUS" | ||
if [[ "${COCKPIT_SERVICE_STATUS}" =~ "Not Installed" ]]; then | ||
OPTION=$(Choose "Install Cockpit" "Cancel") | ||
else | ||
OPTION=$(Choose "Enable Cockpit" "Disable Cockpit") | ||
fi | ||
fi | ||
if [[ "${OPTION,,}" =~ ^install ]]; then | ||
echo 'Installing Cockpit' | ||
echo 'PasswordAuthentication yes' | sudo tee /etc/ssh/sshd_config.d/02-enable-passwords.conf | ||
sudo systemctl try-restart sshd | ||
sudo systemctl enable --now sshd | ||
sudo podman container runlabel --name cockpit-ws RUN quay.io/cockpit/ws | ||
sudo podman container runlabel INSTALL quay.io/cockpit/ws | ||
OPTION="Enable Cockpit" | ||
fi | ||
if [[ "${OPTION,,}" =~ ^enable ]]; then | ||
echo "${green}${b}Enabling${n} Cockpit" | ||
sudo systemctl enable cockpit.service | ||
echo "$(Urllink "http://localhost:9090" "Open Cockpit${n}") -> http://localhost:9090" | ||
elif [[ "${OPTION,,}" =~ ^disable ]]; then | ||
echo "${red}${b}Disabling${n} Cockpit" | ||
sudo systemctl disable cockpit.service | ||
echo "Cockpit has been ${b}${red}disabled${n}" | ||
fi | ||
|
||
alias jetbrains-toolbox := install-jetbrains-toolbox | ||
|
||
# Install JetBrains Toolbox | https://www.jetbrains.com/toolbox-app/ | ||
install-jetbrains-toolbox: | ||
#!/usr/bin/env bash | ||
pushd "$(mktemp -d)" | ||
echo "Get latest JetBrains Toolbox version" | ||
# Get the json with latest releases | ||
curl -sSfL -o releases.json "https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release" | ||
# Extract information | ||
BUILD_VERSION=$(jq -r '.TBA[0].build' ./releases.json) | ||
DOWNLOAD_LINK=$(jq -r '.TBA[0].downloads.linux.link' ./releases.json) | ||
CHECKSUM_LINK=$(jq -r '.TBA[0].downloads.linux.checksumLink' ./releases.json) | ||
echo "Installing JetBrains Toolbox ${BUILD_VERSION}" | ||
curl -sSfL -O "${DOWNLOAD_LINK}" | ||
curl -sSfL "${CHECKSUM_LINK}" | sha256sum -c | ||
tar zxf jetbrains-toolbox-"${BUILD_VERSION}".tar.gz | ||
echo "Launching JetBrains Toolbox" | ||
./jetbrains-toolbox-"${BUILD_VERSION}"/jetbrains-toolbox | ||
|
||
alias touch := install-touch | ||
|
||
# Install a better on-screen-keyboard and gesture improvements | ||
install-touch: | ||
pip install --upgrade gnome-extensions-cli | ||
gext install [email protected] | ||
gext install gestureImprovements@gestures | ||
|
||
alias atuin := install-atuin | ||
|
||
# Add atuin | ||
install-atuin: | ||
#!/usr/bin/bash | ||
shell=$(basename $SHELL) | ||
if test $shell = "fish"; then | ||
echo "Adding atuin to your config.fish" | ||
printf '\nif status is-interactive\n\tif type -q atuin\n\t\tatuin init fish | source\n\tend\nend\n' >> ${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish | ||
elif test $shell = "zsh"; then | ||
echo "Adding atuin to your .zshrc" | ||
printf '\n[[ "$(command -v atuin)" ]] && eval "$(atuin init zsh)"\n' >> ${ZDOTDIR:-$HOME}/.zshrc | ||
elif test $shell = "bash"; then | ||
echo "Adding bash-prexec and atuin to your .bashrc" | ||
printf '\n[[ -f /usr/share/bash-prexec ]] && source /usr/share/bash-prexec\n[[ "$(command -v atuin)" ]] && eval "$(atuin init bash)"\n' >> ~/.bashrc | ||
fi | ||
|
||
alias incus := install-incus | ||
|
||
# Install and configure Incus | ||
install-incus: | ||
#!/usr/bin/env bash | ||
source /usr/lib/ujust/ujust.sh | ||
CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"') | ||
if grep -q "bluefin-dx" <<< $CURRENT_IMAGE | ||
then | ||
echo 'Installing and configuring Incus.' | ||
/usr/bin/bluefin-incus | ||
else | ||
echo "Developer mode is currently ${b}${red}Disabled${n}." | ||
echo "Run \"just devmode\" to turn on Developer mode." | ||
exit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# vim: set ft=make : | ||
######################## | ||
### bluefin-system.just | ||
######################## | ||
## Standardized verbs | ||
# configure- = configure something that is pre-installed on the image | ||
# install- = install something, no uninstall or configuration provided | ||
# setup- = install something and also provide configuration and/or uninstallation options | ||
# toggle- = turn something on/off, logic can be automatic or manual selection | ||
# fix- = apply fix/patch/workaround for something | ||
# foo = no verb is used for shortcuts or something deemed important enough to use a super memorable name | ||
|
||
# Run a one minute system benchmark | ||
benchmark: | ||
echo 'Running a 1 minute benchmark ...' | ||
stress-ng --matrix 0 -t 1m --times | ||
|
||
# Configure Bluefin-CLI Terminal Experience | ||
bluefin-cli: | ||
@/usr/libexec/enable-bluefin-cli.sh | ||
|
||
# Configure Terminal Experience | ||
[private] | ||
configure-terminal: | ||
@/usr/libexec/configure-terminal.sh | ||
|
||
# Toggle between Bluefin and the Developer Experience | ||
devmode: | ||
#!/usr/bin/env bash | ||
CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"') | ||
if grep -q "/var/ublue-os/image" <<< $CURRENT_IMAGE | ||
then | ||
echo "" | ||
echo "Before we can switch to the Bluefin Developer Experience" | ||
echo "the current system needs an update. Please run 'just update'" | ||
echo "and reboot your system when the update is finished." | ||
exit | ||
fi | ||
if grep -q "bluefin-dx" <<< $CURRENT_IMAGE | ||
then | ||
CURRENT_STATE="enabled" | ||
else | ||
CURRENT_STATE="disabled" | ||
fi | ||
echo "Developer mode is currently ${CURRENT_STATE}" | ||
echo "Enable or Disable developer mode" | ||
OPTION=$(gum choose Enable Disable) | ||
if [ "$OPTION" = "Enable" ] | ||
then | ||
if [ "$CURRENT_STATE" = "enabled" ] | ||
then | ||
echo "You are already on a developer image" | ||
else | ||
echo "Rebasing to a developer image" | ||
NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin/bluefin-dx/") | ||
rpm-ostree rebase $NEW_IMAGE | ||
fi | ||
elif [ "$OPTION" = "Disable" ] | ||
then | ||
if [ "$CURRENT_STATE" = "enabled" ] | ||
then | ||
echo "Rebasing to a non developer image" | ||
NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin-dx/bluefin/") | ||
rpm-ostree rebase $NEW_IMAGE | ||
else | ||
echo "You are currently not on a developer image" | ||
fi | ||
fi | ||
|
||
alias shell := configure-shell | ||
|
||
# Switch to a different shell | ||
configure-shell ACTION="": | ||
#!/bin/bash | ||
source /usr/lib/ujust/ujust.sh | ||
CURRENT_SHELL="$(cat /etc/passwd | grep ":$UID:" | cut '-d:' '-f7')" | ||
OPTION={{ ACTION }} | ||
if [ "$OPTION" == "help" ]; then | ||
echo "Usage: ujust shell <option>" | ||
echo " <option>: Specify the quick option to skip the prompt" | ||
echo " Use 'fish' to select fish" | ||
echo " Use 'zsh' to select zsh" | ||
echo " Use 'bash' to select bash" | ||
exit 0 | ||
elif [ "$OPTION" == "" ]; then | ||
echo "${bold}Shell configuration${normal}" | ||
echo "${USER}'s shell is currently ${CURRENT_SHELL}" | ||
OPTION=$(Choose "fish" "zsh" "bash") | ||
fi | ||
if [ -z "$OPTION" ]; then | ||
exit 0 | ||
else | ||
sudo usermod $USER --shell /usr/bin/$OPTION | ||
printf "${USER}'s shell is now %s.\n" "$(cat /etc/passwd | grep ":$UID:" | cut '-d:' '-f7')" | ||
fi | ||
|
||
alias gnome-extensions := get-gnome-extensions | ||
|
||
# Install recommended GNOME extensions | ||
get-gnome-extensions: | ||
pip install --upgrade gnome-extensions-cli | ||
gext install [email protected] | ||
gext install [email protected] | ||
gext install [email protected] | ||
|
||
alias gnome-vrr := toggle-gnome-vrr | ||
|
||
# Enable or Disable Gnome-VRR | ||
toggle-gnome-vrr: | ||
#!/usr/bin/env bash | ||
if gsettings get org.gnome.mutter experimental-features | grep -q "variable-refresh-rate" | ||
then | ||
CURRENT_STATE="Enabled" | ||
else | ||
CURRENT_STATE="Disabled" | ||
fi | ||
echo "Gnome-VRR is currently ${CURRENT_STATE}" | ||
echo "Enable or Disable Gnome-VRR" | ||
OPTION=$(gum choose Enable Disable) | ||
if [ "$OPTION" = "Enable" ] | ||
then | ||
echo "Enabling Gnome-VRR" | ||
gsettings set org.gnome.mutter experimental-features "['variable-refresh-rate','scale-monitor-framebuffer']" | ||
elif [ "$OPTION" = "Disable" ] | ||
then | ||
echo "Disabling Gnome-VRR" | ||
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" | ||
fi | ||
echo "To apply the changes make sure you logout and restart your session" | ||
|
||
# Ptyxis terminal transparency | ||
ptyxis-transparency opacity="0.95": | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
if [[ -n "$(echo "{{ opacity }}" | grep -v '^[.0-9]*$')" ]]; then | ||
printf "Value must be numeric: %s.\n" "{{ opacity }}" | ||
elif [[ $(echo "0<{{ opacity }} && 1>{{ opacity }}" | bc -q) -eq 1 ]]; then | ||
raw="$(gsettings get org.gnome.Ptyxis profile-uuids)" | ||
uuids="$(sed -En 's|[^0-9a-z]*||g; s|([0-9a-z]{32})|\1\n|gp' <<<${raw})" | ||
for i in ${uuids}; do | ||
location="org.gnome.Ptyxis.Profile:/org/gnome/Ptyxis/Profiles/${i}/" | ||
gsettings set "${location}" opacity "{{ opacity }}"; done | ||
printf "Ptyxis opacity is now %s.\n" "{{ opacity }}" | ||
else | ||
printf "Value must be between 0 and 1: %s.\n" "{{ opacity }}" | ||
fi | ||
|
||
# Configure docker,incus-admin,lxd,libvirt container manager permissions | ||
dx-group: | ||
sudo usermod -aG docker $USER | ||
sudo usermod -aG incus-admin $USER | ||
sudo usermod -aG lxd $USER | ||
sudo usermod -aG libvirt $USER | ||
@echo "Logout to use docker, incus-admin, lxd, libvirt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# vim: set ft=make : | ||
######################## | ||
### bluefin-tools.just | ||
######################## | ||
## Standardized verbs | ||
# configure- = configure something that is pre-installed on the image | ||
# install- = install something, no uninstall or configuration provided | ||
# setup- = install something and also provide configuration and/or uninstallation options | ||
# toggle- = turn something on/off, logic can be automatic or manual selection | ||
# fix- = apply fix/patch/workaround for something | ||
# foo = no verb is used for shortcuts or something deemed important enough to use a super memorable name | ||
|
||
# Run pytorch | ||
pytorch: | ||
echo 'Follow the prompts and check the tutorial: https://docs.anaconda.com/free/anaconda/jupyter-notebooks/' | ||
podman pull docker.io/continuumio/miniconda3 | ||
podman run -i -t -p 8888:8888 docker.io/continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir \ | ||
/opt/notebooks && /opt/conda/bin/jupyter notebook \ | ||
--notebook-dir=/opt/notebooks --ip='*' --port=8888 \ | ||
--no-browser --allow-root" | ||
|
||
# Run Tensorflow | ||
tensorflow: | ||
echo 'Follow the prompts and check the tutorial: https://www.tensorflow.org/tutorials/quickstart/beginner' | ||
podman pull docker.io/tensorflow/tensorflow:latest | ||
podman run -it -p 8888:8888 docker.io/tensorflow/tensorflow:latest-jupyter # Start Jupyter server | ||
|
||
# Run the yafti setup tool | ||
yafti: | ||
yafti /etc/yafti.yml --force |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that we may want to do this, but instead of copying over, maybe a symlink might make more sense? This might be a change we need to do on our /etc/profile.d/brew.sh
If that's a file then the user has modified, if it's a symlink we won't have to update? Since this prompt doesn't go away, I would want to avoid overwriting user changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can change that, i think @bketelsen wrote that originally, might be a reason why it is not a symlink instead.
Will wait for them to reply before making that change though, but i am pretty sure a symlink will be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason, symlink is a great idea. please proceed!