Skip to content

Commit

Permalink
Merge pull request #98 from ublue-os/locales
Browse files Browse the repository at this point in the history
fix: locales pwsh/bluefin, pwsh for not root user
  • Loading branch information
m2Giles authored May 18, 2024
2 parents 25d8692 + 3470f38 commit 07c80b9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
13 changes: 8 additions & 5 deletions toolboxes/bluefin-cli/Containerfile.bluefin-cli
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ RUN apk update && \
mv /home/linuxbrew /home/homebrew && \
rm /toolbox-packages

# Use and configure bash, retrieve bash-prexec
RUN curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o /tmp/bash-prexec && \
mkdir -p /usr/share/ && \
cp /tmp/bash-prexec /usr/share/bash-prexec && \
rm -rf /tmp/*
# Configure Locales and get bash-prexec
RUN curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o /tmp/bash-prexec \
&& mkdir -p /usr/share/ \
&& cp /tmp/bash-prexec /usr/share/bash-prexec \
&& printf 'LANG=en_US.utf8\nexport LANG\n' > /etc/profile.d/locale.sh \
&& printf 'LANG=en_US.utf8\nexport LANG\nSTARSHIP_CONFIG=/etc/starship.toml\nexport STARSHIP_CONFIG\neval "$(atuin init zsh)"\neval "$(zoxide init zsh --cmd cd)"\neval "$(starship init zsh)"' >> /etc/zsh/zshrc \
&& printf 'LANG="en_US.UTF-8"' > /etc/locale.conf \
&& rm -rf /tmp/*
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ if test "$(id -u)" -gt "0"
set blue (set_color blue)
set bold (set_color -o blue)
set normal (set_color normal)
if test ! -f /etc/linuxbrew.firstrun
printf "\nBluefin-CLI First Run Setup\n\n"
printf "Setting up sudo for %s%s%s...\t\t\t " "$bold" "$USER" "$normal"
echo "#$UID ALL = (root) NOPASSWD:ALL" | su-exec root tee -a /etc/sudoers > /dev/null
printf "%s[ OK ]%s\n" "$blue" "$normal"
end

if test ! -d /home/linuxbrew/.linuxbrew
set name $(hostname -s)
set xdg_data_home "$XDG_DATA_HOME"
Expand All @@ -19,27 +12,21 @@ if test "$(id -u)" -gt "0"
mkdir -p "$linuxbrew_home"
end
if test ! -d /home/linuxbrew
su-exec root mkdir -p /home/linuxbrew
sudo mkdir -p /home/linuxbrew
end
su-exec root mount --bind "$linuxbrew_home" /home/linuxbrew
su-exec root cp -R /home/homebrew/.linuxbrew /home/linuxbrew/
su-exec root chown -R "$UID" /home/linuxbrew
sudo mount --bind "$linuxbrew_home" /home/linuxbrew
sudo cp -R /home/homebrew/.linuxbrew /home/linuxbrew/
sudo chown -R "$UID" /home/linuxbrew
set -e linuxbrew_home
printf "%s[ OK ]%s\n" "$blue" "$normal"
end

if test ! -d /usr/local/share/bash-completion/completions
printf "Setting up Tab-Completions...\t\t\t "
su-exec root mkdir -p /usr/local/share/bash-completion
su-exec root mount --bind /run/host/usr/share/bash-completion /usr/local/share/bash-completion
if test -x /run/host/usr/bin/ujust
su-exec root ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust
end
printf "%s[ OK ]%s\n" "$blue" "$normal"
if test -x /run/host/usr/bin/ujust
sudo ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust
end

if test ! -f /etc/linuxbrew.firstrun
su-exec root touch /etc/linuxbrew.firstrun
sudo touch /etc/linuxbrew.firstrun
printf "\nBluefin-CLI first run complete!\n\n"
end
end
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
if status is-interactive
set -gx STARSHIP_CONFIG /etc/starship.toml
set -gx LANG en_US.utf8
eval "$(starship init fish)"
eval "$(atuin init fish)"
eval "$(zoxide init fish --cmd cd)"
set -gx HOST (hostname -s)
end


# Eza for ls
alias ll='eza -l --icons=auto --group-directories-first' 2>/dev/null
alias l.='eza -d .*' 2>/dev/null
Expand Down
2 changes: 2 additions & 0 deletions toolboxes/bluefin-cli/packages.bluefin-cli
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
atuin
bat
brew
delta
gawk
glibc-locale-en
eza
fd
fish
Expand Down
29 changes: 16 additions & 13 deletions toolboxes/powershell-toolbox/Containerfile.powershell
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# hadolint ignore=DL3007
FROM ghcr.io/ublue-os/wolfi-base:latest
FROM ghcr.io/ublue-os/wolfi-toolbox:latest

LABEL com.github.containers.toolbox="true" \
name="powershell-toolbox" \
Expand All @@ -9,12 +9,10 @@ LABEL com.github.containers.toolbox="true" \
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1

COPY packages.powershell /tmp
COPY profile.ps1 /tmp
# COPY ./toolboxes/powershell-toolbox/packages.powershell /tmp
# COPY ./toolboxes/powershell-toolbox/profile.ps1 /tmp

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
# COPY packages.powershell /tmp
# COPY profile.ps1 /tmp
COPY ./toolboxes/powershell-toolbox/packages.powershell /tmp
COPY ./toolboxes/powershell-toolbox/profile.ps1 /tmp

RUN apk upgrade \
&& grep -v '^#' /tmp/packages.powershell | xargs apk add --no-cache \
Expand All @@ -23,12 +21,17 @@ RUN apk upgrade \
&& curl -s https://ohmyposh.dev/install.sh | bash -s -- -t /usr/local/share/oh-my-posh/themes \
&& curl -LSfs https://raw.githubusercontent.com/cantino/mcfly/master/ci/install.sh | sh -s -- --git cantino/mcfly \
&& cp /tmp/profile.ps1 "$(~/.dotnet/tools/pwsh -Command "\$PROFILE.AllUsersAllHosts")" \
&& mkdir -p ~/.local/share/powershell/PSReadLine \
&& touch ~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt \
&& echo 'if test ! -f ${XDG_DATA_HOME:-${HOME}/.local/share}/powershell/PSReadLine/ConsoleHost_history.txt; then mkdir -p ${XDG_DATA_HOME:-${HOME}/.local/share}/powershell/PSReadLine/ && touch ${XDG_DATA_HOME:-${HOME}/.local/share}/powershell/PSReadLine/ConsoleHost_history.txt; fi' > /etc/profile.d/mcfly-history.sh \
&& printf 'LANG=en_US.utf8\nexport LANG\n' > /etc/profile.d/locale.sh \
&& printf 'exec /usr/lib/dotnet/tools/pwsh' > /etc/profile.d/zz-pwsh.sh \
&& mkdir -p /etc/zsh \
&& printf 'LANG=en_US.utf8\nexport LANG\nexec /usr/lib/dotnet/tools/pwsh' >> /etc/zsh/zlogin \
&& mkdir -p /etc/fish \
&& printf 'if status is-login\n\tset -gx LANG en_US.utf8\n\texec /usr/lib/dotnet/tools/pwsh\nend\n' >> /etc/fish/config.fish \
&& cp -r ~/.dotnet /usr/lib/dotnet \
&& printf 'LANG="en_US.UTF-8"' > /etc/locale.conf \
&& chown -R 1000:1000 /usr/lib/dotnet \
&& rm -rf /tmp/*

ENV DOTNET_TOOLS=~/.dotnet/tools
ENV DOTNET_TOOLS=/usr/lib/dotnet/tools
ENV PATH=${DOTNET_TOOLS}:${PATH}



3 changes: 3 additions & 0 deletions toolboxes/powershell-toolbox/packages.powershell
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ bat
dotnet-8-sdk
eza
fd
fish
fzf
gawk
glibc-locale-en
jq
ripgrep
sed
zoxide
zsh

0 comments on commit 07c80b9

Please sign in to comment.