Skip to content

Commit

Permalink
fix(bluefin-cli): Swap su-exec for sudo in firstrun scripts
Browse files Browse the repository at this point in the history
Signed-off-by: RJ Trujillo <[email protected]>
  • Loading branch information
EyeCantCU committed Apr 28, 2024
1 parent 31af528 commit efe31d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions wolfi/bluefin-base/etc/profile.d/00-bluefin-cli-brew-firstrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if test "$(id -u)" -gt "0"; then
if test ! -f /etc/linuxbrew.firstrun; then
printf "\nBluefin-CLI First Run Setup\n\n"
printf "Setting up sudo for %s%s%s%s...\t\t\t " "$bold" "$blue" "$USER" "$normal"
echo "#$(id -u) ALL = (root) NOPASSWD:ALL" | su-exec root tee -a /etc/sudoers > /dev/null
echo "#$(id -u) ALL = (root) NOPASSWD:ALL" | sudo tee -a /etc/sudoers > /dev/null
printf "%s[ OK ]%s\n" "${blue}" "${normal}"
fi

Expand All @@ -21,27 +21,27 @@ if test "$(id -u)" -gt "0"; then
fi
fi
if test ! -d /home/linuxbrew; then
su-exec root mkdir -p /home/linuxbrew
sudo mkdir -p /home/linuxbrew
fi
su-exec root mount --bind "${linuxbrew_home}" /home/linuxbrew
su-exec root cp -R /home/homebrew/.linuxbrew /home/linuxbrew/
su-exec root chown -R "$(id -u)" /home/linuxbrew
sudo mount --bind "${linuxbrew_home}" /home/linuxbrew
sudo cp -R /home/homebrew/.linuxbrew /home/linuxbrew/
sudo chown -R "$(id -u)" /home/linuxbrew
unset linuxbrew_home
printf "%s[ OK ]%s\n" "${blue}" "${normal}"
fi

if test ! -d /usr/local/share/bash-completion/completions; then
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
sudo mkdir -p /usr/local/share/bash-completion
sudo mount --bind /run/host/usr/share/bash-completion /usr/local/share/bash-completion
if test -x /run/host/usr/bin/ujust; then
su-exec root ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust
sudo ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust
fi
printf "%s[ OK ]%s\n" "${blue}" "${normal}"
fi

if test ! -f /etc/linuxbrew.firstrun; then
su-exec root touch /etc/linuxbrew.firstrun
sudo touch /etc/linuxbrew.firstrun
printf "\nBluefin-CLI first run complete!\n\n"
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if test "$(id -u)" -gt "0"
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
echo "#$UID ALL = (root) NOPASSWD:ALL" | sudo tee -a /etc/sudoers > /dev/null
printf "%s[ OK ]%s\n" "$blue" "$normal"
end

Expand All @@ -19,27 +19,27 @@ 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
sudo mkdir -p /usr/local/share/bash-completion
sudo 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
sudo ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust
end
printf "%s[ OK ]%s\n" "$blue" "$normal"
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

0 comments on commit efe31d7

Please sign in to comment.