Skip to content

Commit

Permalink
sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 27, 2024
1 parent 493c466 commit d79763a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
4 changes: 4 additions & 0 deletions help/sudo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ set -e
set -o pipefail

if "${LOCAL}/help/is-linux.sh"; then
if [ ! "$(id -u)" = 0 ]; then
echo "You should run it as root: 'sudo make install'"
exit 1
fi
"$@"
else
sudo "$@"
Expand Down
7 changes: 0 additions & 7 deletions installs/install-pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
set -e
set -o pipefail

if "${LOCAL}/help/is-linux.sh"; then
if [ ! "$(id -u)" = 0 ]; then
echo "You should run it as root: 'sudo make install'"
exit 1
fi
fi

"${LOCAL}/help/assert-tool.sh" python3 --version
"${LOCAL}/help/assert-tool.sh" pip --version

Expand Down
21 changes: 7 additions & 14 deletions steps/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,15 @@ set -o pipefail
set -x

if "${LOCAL}/help/is-linux.sh"; then
if [ ! "$(id -u)" = 0 ]; then
echo "You should run it as root: 'sudo make install'"
exit 1
fi
fi

if "${LOCAL}/help/is-linux.sh"; then
apt-get update -y --fix-missing
apt-get install -y coreutils
"${LOCAL}/help/sudo.sh" apt-get update -y --fix-missing
"${LOCAL}/help/sudo.sh" apt-get install -y coreutils
fi

function install_package() {
local PACKAGE=$1
if ! eval "$PACKAGE" --version >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
apt-get install -y "$PACKAGE"
"${LOCAL}/help/sudo.sh" apt-get install -y "$PACKAGE"
else
"${LOCAL}/help/assert-tool.sh" "${PACKAGE}" --version
fi
Expand All @@ -60,17 +53,17 @@ install_package gawk

if ! pdftotext -v >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
apt-get install -y xpdf
"${LOCAL}/help/sudo.sh" apt-get install -y xpdf
else
"${LOCAL}/help/assert-tool.sh" pdftotext -v
fi
fi

if ! inkscape --version >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
add-apt-repository -y ppa:inkscape.dev/stable && \
apt-get update -y --fix-missing && \
apt-get install -y inkscape
"${LOCAL}/help/sudo.sh" add-apt-repository -y ppa:inkscape.dev/stable && \
"${LOCAL}/help/sudo.sh" apt-get update -y --fix-missing && \
"${LOCAL}/help/sudo.sh" apt-get install -y inkscape
else
"${LOCAL}/help/assert-tool.sh" inkscape --version
fi
Expand Down

0 comments on commit d79763a

Please sign in to comment.