Multiple changes towards better Ubuntu support :)

This commit is contained in:
2025-08-26 16:47:06 +02:00
parent a432e30f47
commit 986b9d8992
7 changed files with 86 additions and 20 deletions

View File

@@ -99,7 +99,7 @@ install_docker() {
} }
install_kubectl() { install_kubectl() {
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list
chmod 644 /etc/apt/sources.list.d/kubernetes.list chmod 644 /etc/apt/sources.list.d/kubernetes.list
@@ -110,34 +110,51 @@ install_kubectl() {
export EXTRA_INSTALL_MESSAGE="Installing snap packages" export EXTRA_INSTALL_MESSAGE="Installing snap packages"
extra_init() { extra_init() {
# Install ghostty # Install ghostty
echo -ne "ghostty"
# TODO: use a ppa / something updatable
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mkasberg/ghostty-ubuntu/HEAD/install.sh)" >/dev/null 2>&1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mkasberg/ghostty-ubuntu/HEAD/install.sh)" >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "${BRed}Could not install ghostty. Skipping.${NC}" echo -e "${BRed}Could not install ghostty. Skipping.${NC}"
fi fi
erase_text "ghostty"
# Install VSCode
# NOTE: would be better to install code-oss, and features+marketplace
echo -ne "code"
sudo snap install code --classic >/dev/null 2>&1
erase_text "code"
# TODO: Install code-oss, and features+marketplace
# TODO: Install jellyfin-media-player # TODO: Install jellyfin-media-player
# Install android-studio # Install android-studio
sudo snap install android-studio --classic >/dev/null 2>&1 echo -ne "android-studio"
snap install android-studio --classic >/dev/null 2>&1
erase_text "android-studio"
# TODO: Install zen browser # TODO: Install zen browser
echo -ne "github-cli"
install_github_cli >/dev/null 2>&1 install_github_cli >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "${BRed}Could not install github-cli. Skipping.${NC}" echo -e "${BRed}Could not install github-cli. Skipping.${NC}"
fi fi
erase_text "github-cli"
# Docker, Kubectl # Docker, Kubectl
echo -ne "docker"
install_docker >/dev/null 2>&1 install_docker >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "${BRed}Could not install docker. Skipping.${NC}" echo -e "${BRed}Could not install docker. Skipping.${NC}"
fi fi
erase_text "docker"
echo -ne "kubectl"
install_kubectl >/dev/null 2>&1 install_kubectl >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "${BRed}Could not install kubectl. Skipping.${NC}" echo -e "${BRed}Could not install kubectl. Skipping.${NC}"
fi fi
erase_text "kubectl"
} }
extra_finish() { extra_finish() {

29
dotfiles.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
install_dotfile_ifnot() {
mkdir -p $(dirname -- /home/${USERNAME}/${1})
cp --update=none ${script_dir}/dotfiles/${1} /home/${USERNAME}/${1}
}
echo "Installing dotfiles..."
# cp -r --update=none ${script_dir}/dotfiles/. /home/${USERNAME}/
cat ${script_dir}/dotfiles/.config/git/config | envsubst '$GIT_USER $EMAIL' >/home/${USERNAME}/.config/git/config
# Install bashrc if not mymachine-installed
if ! [[ "$(head -n 1 /home/${USERNAME}/.bashrc)" = "# mymachine" ]]; then
cp "${script_dir}/dotfiles/.bashrc" "/home/${USERNAME}/.bashrc"
fi
# Install code settings depending on which code is installed
CODE_NAME="Code - OSS"
if [ "${ID}" = "ubuntu" ]; then
# On Ubuntu, we install official code snap
CODE_NAME="Code"
fi
mkdir -p /home/${USERNAME}/.config/${CODE_NAME}/User
cp "${script_dir}/dotfiles/.config/Code - OSS/User/settings.json" "/home/${USERNAME}/.config/${CODE_NAME}/User/settings.json"
# Install ghostty, git, gh settings if not present
install_dotfile_ifnot .config/ghostty/config
install_dotfile_ifnot .config/git/config
install_dotfile_ifnot .config/gh/config.yml

View File

@@ -1,10 +1,13 @@
# # mymachine
# ~/.bashrc # ~/.bashrc
# #
# If not running interactively, don't do anything # If not running interactively, don't do anything
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
# OS-specific information
source /etc/os-release
# History file settings # History file settings
# No duplicate lines / lines starting with space in history # No duplicate lines / lines starting with space in history
HISTCONTROL=ignoreboth HISTCONTROL=ignoreboth
@@ -34,7 +37,12 @@ fi
source /home/${USER}/.config/prompt.sh source /home/${USER}/.config/prompt.sh
# Bitwarden SSH agent # Bitwarden SSH agent
export SSH_AUTH_SOCK=/home/${USER}/.bitwarden-ssh-agent.sock if [ "${ID}" = "ubuntu" ]; then
# On Ubuntu, Bitwarden snap is used, which changes the sock path
export SSH_AUTH_SOCK=/home/${USER}/snap/bitwarden/current/.bitwarden-ssh-agent.sock
else
export SSH_AUTH_SOCK=/home/${USER}/.bitwarden-ssh-agent.sock
fi
# PATH modifications # PATH modifications
# Local binaries # Local binaries
@@ -48,3 +56,5 @@ alias e=${EDITOR}
alias l="ls -lla" alias l="ls -lla"
alias c="clear" alias c="clear"
alias k="kubectl" alias k="kubectl"
### End of default bashrc, append anything here

View File

@@ -26,5 +26,9 @@
"workbench.preferredDarkColorTheme": "Adwaita Dark", "workbench.preferredDarkColorTheme": "Adwaita Dark",
"workbench.preferredLightColorTheme": "Adwaita Light", "workbench.preferredLightColorTheme": "Adwaita Light",
"editor.renderLineHighlight": "none", "editor.renderLineHighlight": "none",
"workbench.tree.indent": 12 "workbench.tree.indent": 12,
"redhat.telemetry.enabled": false,
"telemetry.feedback.enabled": false,
"telemetry.telemetryLevel": "off",
"docker.lsp.telemetry": "off",
} }

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source /etc/os-release
parse_git_branch() parse_git_branch()
{ {
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ <\1>/') branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ <\1>/')

View File

@@ -106,6 +106,13 @@ fi
# Install packages # Install packages
source ${script_dir}/distribution/${ID}/install.sh source ${script_dir}/distribution/${ID}/install.sh
erase_text() {
# Remove text from terminal
count=$(echo "${1}" | wc -m)
for ((i=1; i<$count; i++)); do echo -ne '\b'; done
for ((i=1; i<$count; i++)); do echo -ne ' '; done
for ((i=1; i<$count; i++)); do echo -ne '\b'; done
}
install_package() { install_package() {
package="${1}" package="${1}"
command="${2}" command="${2}"
@@ -118,11 +125,7 @@ install_package() {
echo -e "\n${BRed}Failed to install package '${package}'. Skipping." echo -e "\n${BRed}Failed to install package '${package}'. Skipping."
fi fi
# Remove current package name from terminal erase_text "${package}"
count=$(echo "${package}" | wc -m)
for ((i=1; i<$count; i++)); do echo -ne '\b'; done
for ((i=1; i<$count; i++)); do echo -ne ' '; done
for ((i=1; i<$count; i++)); do echo -ne '\b'; done
} }
refresh_package_db refresh_package_db
@@ -138,8 +141,9 @@ done
echo "" echo ""
# Install distribution-specific extra packages # Install distribution-specific extra packages
echo -e "Initializing extra package installation..." echo -ne "Initializing extra package installation... "
extra_init extra_init
echo ""
echo -ne "${EXTRA_INSTALL_MESSAGE}... " echo -ne "${EXTRA_INSTALL_MESSAGE}... "
for package in "${EXTRA_PACKAGES[@]}"; do for package in "${EXTRA_PACKAGES[@]}"; do
install_package "${package}" install_extra_command install_package "${package}" install_extra_command
@@ -165,6 +169,12 @@ fi
export VSCODE_EXTENSIONS="${script_dir}/vscode-extensions.txt" export VSCODE_EXTENSIONS="${script_dir}/vscode-extensions.txt"
echo -ne "Installing VSCode extensions... " echo -ne "Installing VSCode extensions... "
i=0 total=$(wc -l < ${VSCODE_EXTENSIONS}); while read ext; do i=0 total=$(wc -l < ${VSCODE_EXTENSIONS}); while read ext; do
# Ignore commented extensions
if [[ "${ext}" == \#* ]]; then
i=$((i + 1))
continue
fi
# TODO: Here we assume extensions are at most a 2-digit number ; change that :) # TODO: Here we assume extensions are at most a 2-digit number ; change that :)
istr=$(printf "%02d" $i) istr=$(printf "%02d" $i)
echo -ne "\b\b\b\b\b${istr}/${total}" echo -ne "\b\b\b\b\b${istr}/${total}"
@@ -181,9 +191,7 @@ if [[ $i = $total ]]; then
fi fi
# Install dotfiles, without overwriting # Install dotfiles, without overwriting
echo "Installing dotfiles..." source "${script_dir}/dotfiles.sh"
cp -r --update=none ${script_dir}/dotfiles/. /home/${USERNAME}/
cat ${script_dir}/dotfiles/.config/git/config | envsubst '$GIT_USER $EMAIL' >/home/${USERNAME}/.config/git/config
# Setup GRUB theme # Setup GRUB theme
echo "Setting up GRUB theme..." echo "Setting up GRUB theme..."
@@ -223,4 +231,4 @@ if [ "$MICROCODE_INSTALLED" == "false" ]; then
fi fi
echo "To use WireGuard, don't forget to add this client on VPN server (your private key is under ~/.wireguard/privatekey)" echo "To use WireGuard, don't forget to add this client on VPN server (your private key is under ~/.wireguard/privatekey)"
echo "To use GitHub, you need to use 'gh auth login' to connect to GitHub" echo "To use GitHub, you need to use 'gh auth login' to connect to GitHub"
echo -e "${BNC}Goodbye ! Make sure to ${BGreen}reboot${BNC} to apply all changes !${NC}" echo -e "${BNC}Goodbye ! Make sure to ${BGreen}reboot${NC}${BNC} to apply all changes !${NC}"

View File

@@ -33,7 +33,7 @@ ms-vscode.hexeditor
ms-vscode.makefile-tools ms-vscode.makefile-tools
ms-vscode.remote-explorer ms-vscode.remote-explorer
ms-vscode.vscode-serial-monitor ms-vscode.vscode-serial-monitor
nvarner.typst-lsp # nvarner.typst-lsp
piousdeer.adwaita-theme piousdeer.adwaita-theme
pkief.material-icon-theme pkief.material-icon-theme
pkief.material-product-icons pkief.material-product-icons