From deaa76c9ede33b3fd9b19ef1c57ae1a259e0a653 Mon Sep 17 00:00:00 2001 From: Eduard Toloza Date: Sat, 30 Jun 2018 09:21:41 -0500 Subject: [PATCH] Added simplechek script for updates check --- simpleaur | 8 ++++---- simplecheck | 24 ++++++++++++++++++++++++ simplesearch | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100755 simplecheck diff --git a/simpleaur b/simpleaur index c95f42f..ff2cf36 100755 --- a/simpleaur +++ b/simpleaur @@ -1,12 +1,12 @@ #!/bin/sh -# install AUR packages +# install AUR packages ipackage="$1" #Take the package name from the first ARG passed. basebuilddir="$HOME/Build" #Define the base Build DIR builddir="$HOME/Build/$ipackage" #Define the package Build DIR #Check if the base Build DIR exists, if not create it. if [ ! -d "$basebuilddir" ]; then - mkdir "$basebuilddir" + mkdir "$basebuilddir" fi #Define the function that install the AUR package in the system @@ -16,9 +16,9 @@ function installpackage() { #Check if the git clone was sucesfull and decide what to do. if [ -f "$builddir/PKGBUILD" ]; then #Go to the package download directory and execute makepkg to build. - cd "$builddir" && ${EDITOR:-vi} PKGBUILD || exit + cd "$builddir" && ${EDITOR:-vim} PKGBUILD || exit makepkg -si && cd - &>/dev/null - + #Ask to the user if want to remove the directory created for git read -p "Remove build directory? [Y/n]? " yn #Take the answer from the user input and decide what to do. diff --git a/simplecheck b/simplecheck new file mode 100755 index 0000000..c5f9f1f --- /dev/null +++ b/simplecheck @@ -0,0 +1,24 @@ +#!/usr/bin/bash +# Script for check package updates from AUR +pacmaninstalled="/usr/bin/pacman" +simplesearchlocal="./simplesearch" +simplesearchglobal="/usr/bin/simplesearch" + +if [ ! -f "$pacmaninstalled" ]; then + printf "\n%s\n" "You are not using ArchLinux (pacman not found in $pacmaninstalled)" + exit +elif [ ! -f "$simplesearchlocal" ] && [ ! -f "$simplesearchglobal" ]; then + printf "\n%s\n" "simplesearch not found, make sure that you have the simplesearch script in the current folder or in /usr/bin/simplesearch" + exit +else + if [ -f "$simplesearchlocal" ]; then + printf "\n%s\n%s\n" "The following packages are availables for update, you can update one to one using: simpleaur package_name" + for aurpkg in $(pacman -Qmq); do ./simplesearch "$aurpkg" |grep "installed:"; done + exit + + elif [ -f "$simplesearchglobal" ]; then + printf "\n%s\n%s\n" "The following packages are availables for update, you can update one to one using: simpleaur package_name\n" + for aurpkg in $(pacman -Qmq); do simplesearch "$aurpkg" |grep "installed:"; done + exit + fi +fi diff --git a/simplesearch b/simplesearch index 24fd1e9..ccdf035 100755 --- a/simplesearch +++ b/simplesearch @@ -3,7 +3,7 @@ cowerinstalled="/usr/bin/cower" spackage=( "$@" ) if [ ! -f "$cowerinstalled" ]; then - printf "\n%s\n" "Please, install cower first running in your terminal: gpg --recv-keys --keyserver hkp://pgp.mit.edu 1EB2638FF56C0C53 && simpleaur cower" + printf "\n%s\n" "Please, install cower first running in your terminal: gpg --recv-keys 1EB2638FF56C0C53 && simpleaur cower" else if [ "${#spackage[@]}" -ge 0 ]; then cower -sc "${spackage[@]}"