From 6f4b769737404d24a164203dd154128091127f5a Mon Sep 17 00:00:00 2001 From: Seppia Date: Sun, 3 Jun 2018 20:56:23 +0200 Subject: Function messages Addes messages in each function. --- repofish | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/repofish b/repofish index f97d139..bff0cb3 100755 --- a/repofish +++ b/repofish @@ -12,6 +12,7 @@ SEARCH_STR='rpc/?v=5&type=search&by=name-desc&arg=' add_packages() { declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mAdding following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do if [ ! -d "${SRC_PATH}/$i" ]; then cd ${SRC_PATH} @@ -24,6 +25,7 @@ add_packages() { clone_package() { if [ ! -d "${SRC_PATH}/$(echo $1 | awk -F '/' '{print $NF}' | cut -d '.' -f 1)" ]; then + echo -e '\033[1;34m:: \033[1;37mCloning url: '"$1"'' cd ${SRC_PATH} git clone $1 else @@ -33,6 +35,7 @@ clone_package() { rm_packages() { declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mRemoving following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do if [ -d "${SRC_PATH}/$i" ]; then rm -rf ${SRC_PATH}/$i @@ -51,16 +54,19 @@ check_package() { } list_packages() { + echo -e '\033[1;34m:: \033[1;37mPackages locally available:' find ${SRC_PATH}/* -type d -prune | awk -F '/' '{print $NF}' } clean_packages() { if [ "$1" != '' ]; then declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mCleaning following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do find ${SRC_PATH} -type f -iname "*$i*.pkg.tar.xz" -exec rm {} \; done else + echo -e '\033[1;34m:: \033[1;37mCleaning all packages' find ${SRC_PATH} -type f -iname "*.pkg.tar.xz" -exec rm {} \; fi } @@ -68,11 +74,13 @@ clean_packages() { build_packages() { if [ "$1" != '' ]; then declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mBuilding following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do cd $(find ${SRC_PATH}/* -type d -prune -iname "*$i") makepkg -Cs done else + echo -e '\033[1;34m:: \033[1;37mBuilding all packages' for i in $(find ${SRC_PATH}/* -type d -prune) do cd $i @@ -84,6 +92,7 @@ build_packages() { upgrade_packages() { if [ "$1" != '' ]; then declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mUpgrading following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do cd $(find ${SRC_PATH}/* -type d -prune -iname "*$i") git fetch @@ -92,6 +101,7 @@ upgrade_packages() { makepkg -Cs done else + echo -e '\033[1;34m:: \033[1;37mUpgrading all packages' for i in $(find ${SRC_PATH}/* -type d -prune) do cd $i @@ -106,6 +116,7 @@ upgrade_packages() { update_packages() { if [ "$1" != '' ]; then declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mUpdating following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do cd $(find ${SRC_PATH}/* -type d -prune -iname "*$i") git fetch @@ -113,6 +124,7 @@ update_packages() { git merge done else + echo -e '\033[1;34m:: \033[1;37mUpdating all packages' for i in $(find ${SRC_PATH}/* -type d -prune) do cd $i @@ -125,6 +137,7 @@ update_packages() { install_packages() { declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mInstalling following packages: '"${pkg[@]}"'' for i in "${pkg[@]}"; do if [ -d "${SRC_PATH}/$i" ]; then cd $(find ${SRC_PATH}/* -type d -prune -iname "*$i") @@ -138,11 +151,13 @@ install_packages() { update_repo() { if [ "$1" != '' ]; then declare -a pkg=("${!1}") + echo -e '\033[1;34m:: \033[1;37mUpdating following packages in local repository: '"${pkg[@]}"'' for i in "${pkg[@]}"; do find ${SRC_PATH} -type f -iname "*$i*pkg.tar.xz" -exec cp {} ${REPO_PATH}/x86_64/ \; repo-add ${REPO_PATH}/x86_64/${REPO_NAME}.db.tar.gz ${REPO_PATH}/x86_64/*$i*.pkg.tar.xz done else + echo -e '\033[1;34m:: \033[1;37mUpdating all packages in local repository' find ${SRC_PATH} -type f -iname "*pkg.tar.xz" -exec cp {} ${REPO_PATH}/x86_64/ \; repo-add ${REPO_PATH}/x86_64/${REPO_NAME}.db.tar.gz ${REPO_PATH}/x86_64/*.pkg.tar.xz fi @@ -162,15 +177,15 @@ search_packages() { } set_variables() { - echo "WARNING: SRC_PATH variable not set." + echo -e '\033[1;33mWARNING:\033[m SRC_PATH variable not set.' echo - echo "You need to set the following variables in your profile:" + echo 'You need to set the following variables in your profile:' echo echo " export SRC_PATH='/path/to/packages/sources'" echo " export REPO_PATH='/path/to/archlinux/repo'" echo " export REPO_NAME='repo_name'" echo - echo "The REPO_PATH and REPO_NAME variables are only needed if you use the local repo feature." + echo 'The REPO_PATH and REPO_NAME variables are only needed if you use the local repo feature.' echo "Just set the SRC_PATH if you don't intend to use it." } -- cgit v1.2.3