#!/bin/bash # # Type: Script Shell # Description: Shell script to download the Pamac installer. # # Supported Architecture: all # Release State: 1.0.0 # Script Name: pamac # Project: https://github.com/williamcanin/pamac.git # Author: William C. Canin # E-Mail: william.costa.canin@gmail.com # Home page: http://williamcanin.me # Utils function _msg_header_() { printf "\e[0;36m→ %s\e[0m$2" "$1" } function _msg_reply_() { printf "\e[0;36m→ %s\e[0m$2" "$1" } function _msg_finish_() { printf "\e[0;32m✔ %s\e[0m\n" "$@" } function _msg_warning_() { printf "\e[0;33m⚠ %s\e[0m\n" "$@" } function _msg_error_() { printf "\e[0;31m✖ %s\e[0m\n" "$@" } # Functions ---------------------------------- # # Check user root function _verify_user(){ if [ "$(id -u)" == "0" ]; then _msg_error_ "You can not run this script with root user." exit 1 fi } # Function to verify that Git is installed. function _verify_install_git(){ verify_git="$(pacman -Qs git | grep "local/git" | cut -d'/' -f2 | awk '{print $1}')" if [[ "$verify_git" != "git" ]]; then _msg_header_ "Install Git..." "\n" _msg_warning_ "[ Enter the password for sudo ]" sudo pacman -S git sudo -k _msg_finish_ "Done!" fi } # Function to download the Pamac installer. function _download_pamac_installer(){ _msg_header_ "Download installer for Pamac..." "\n" mkdir -p $HOME/.pamac # git clone git@github.com:williamcanin/pamac.git $HOME/.pamac git clone https://github.com/williamcanin/pamac.git $HOME/.pamac _msg_finish_ "Done!" sleep 1 reset } # Function to start the installation of the Pamac function _install_pamac(){ _msg_header_ "For install Pamac, run the command below:" "\n" _msg_warning_ "> bash \$HOME/.pamac/install" } # Starts the functions. _verify_user _verify_install_git _download_pamac_installer _install_pamac # # -----------------------------------------------