diff --git a/README.md b/README.md index 3bcc9be..38eb0e0 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,18 @@ commands/routines just by typing out the command's name. ## Installation -+ Clone or [download] this repository. -+ `cd` into its directory. -+ Launch the `install.sh` script like so: - ```shell - ./install.sh - ``` +**Note:** It only works on Ubuntu or Arch based distributions, since it uses either `apt` or `pacman` to install. + +```shell +git clone https://github.com/marcoplaitano/evemenu +cd evemenu && ./install.sh +``` + +What the `install.sh` script does is installing [my own patched version] of +dmenu with all its dependencies. + +**Note:** `evemenu` will be in `$HOME/.local/bin`; make sure this is in +`$PATH`. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -65,17 +71,7 @@ to open a new window/tab of firefox and load the Github website. ## Dependencies -Listed below are all the tools and libs used to download and install **dmenu**. -They are all automatically installed and properly used in the [installation -script]. - -+ wget -+ tar -+ gcc -+ make -+ libx11-dev -+ libxinerama-dev -+ libxft-dev +The only dependency is dmenu. It is installed via this [script]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -107,13 +103,17 @@ https://github.com/marcoplaitano/images/blob/main/evemenu_demo.gif https://github.com/marcoplaitano/evemenu/archive/refs/heads/master.zip "Zip download" +[my own patched version]: +https://github.com/marcoplaitano/dmenu +"My dmenu repository" + [file itself]: evemenu "Repository file" -[installation script]: -install.sh -"Repository file" +[script]: +https://github.com/marcoplaitano/dmenu/tree/main/install.sh +"dmenu installation script" [MIT]: LICENSE diff --git a/install.sh b/install.sh index 4ea3328..feea6d0 100755 --- a/install.sh +++ b/install.sh @@ -1,57 +1,40 @@ #!/bin/env bash # File: install.sh -# Author: Marco Plaitano https://github.com/marcoplaitano +# Author: Marco Plaitano +# Github: https://github.com/marcoplaitano/evemenu # Date: 01 Aug 2022 # Brief: Download and install dmenu; make the evemenu script executable. # -# Copyright (c) 2022 Marco Plaitano +# Copyright (c) 2023 Marco Plaitano -################################################## -# FUNCTIONS # -################################################## - - -function safe_exit { - [[ $(pwd) == */dmenu-5.0 ]] && popd - [[ -f dmenu.tar.gz ]] && rm dmenu.tar.gz - [[ -d dmenu-5.0/ ]] && rm -r --interactive=never dmenu-5.0/ - exit $1 -} - - -# Show error message and stop the execution of the script. -function raise_error { +_die() { [[ -n $1 ]] && error_msg="ERROR: $1" || error_msg="Error in 'install.sh'." echo "$error_msg" - safe_exit 1 + exit 1 } -################################################## -# MAIN BODY # -################################################## - - -echo "########## INSTALLING DEPENDENCIES" -sudo apt install -y tar wget gcc make libx11-dev libxinerama-dev libxft-dev -[[ $? -ne 0 ]] && raise_error "Could not install needed dependencies." - - -echo "########## DOWNLOADING DMENU'S SOURCE CODE" -wget https://dl.suckless.org/tools/dmenu-5.0.tar.gz -O ./dmenu.tar.gz -[[ $? -ne 0 ]] && raise_error "Could not download source code from website." -tar xvfz dmenu.tar.gz > /dev/null -[[ $? -ne 0 ]] && raise_error "Could not extract source code folder." - echo "########## INSTALLING DMENU" -pushd dmenu-5.0 || raise_error "Could not find folder containing source code." -sudo make install -[[ $? -ne 0 ]] && raise_error "Could not install dmenu." - -echo "########## ADDING evemenu SCRIPT TO /usr/local/bin" -sudo cp ./evemenu /usr/local/bin && sudo chmod +x /usr/local/bin/evemenu - -echo "Installation succeded. Run with the command 'evemenu'." -safe_exit +dmenu_repo="https://github.com/marcoplaitano/dmenu" +dmenu_dir="/tmp/dmenu-dir" +if git clone "$dmenu_repo" "$dmenu_dir" ; then + pushd dmenu &>/dev/null + ./install.sh || _die "Could not install dmenu." + popd &>/dev/null + [[ -d "$dmenu_dir" ]] && rm -rf "$dmenu_dir" +else + _die "Could not download dmenu from $dmenu_repo'." +fi + +echo "########## INSTALLING EVEMENU" +chmod +x ./evemenu +mkdir -p "$HOME/.local/bin" +cp ./evemenu "$HOME/.local/bin" + +if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then + echo "evemenu is installed." +else + echo "WARNING: Add \$HOME/.local/bin to \$PATH to execute evemenu." +fi