#!/bin/bash REPO="$(cat repo.txt | tr -d '[:blank:]' | tr -d '[:space:]')" echo -n $( dirname -- "$( readlink -f -- "$0" )" ) > pwd.txt CWD=$(cat pwd.txt) dir_list=$(find . -mindepth 2 -maxdepth 4 -name "PKGBUILD" -type f) for i in ${dir_list[@]} do path="$(dirname $i)" full_path="$CWD/$path" echo "$full_path" cd "$full_path" git_dir="$(find . -mindepth 1 -maxdepth 1 -name "$(basename $full_path)" -type d)" if [ -n "$git_dir" ] && [ -d "$git_dir" ]; then echo "rm -rf $git_dir" rm -rf "$git_dir" fi if [ -d "$full_path/src" ]; then rm -rf "$full_path/src" fi if [ -d "$full_path/pkg" ]; then rm -rf "$full_path/pkg" fi pkg_file=$(find . -mindepth 1 -maxdepth 1 -name "*.pkg.tar.xz$" -type f) sig_file="${pkg_file}.sig" if [ ! -f "$sig_file" ]; then for i in $pkg_file do if [ -f "${i}" ]; then if [ -f "$i.sig" ]; then echo "Удаление подписи $i.sig" rm -f $i.sig fi echo "Добавление подписи $i.sig" gpg --detach-sign --local-user BC8B600E8DDA1F4CB77B10D2BA803A261A5EE6B8 --output "$i.sig" "$i" fi done fi if [ -n "$git_dir" ] && [ -d "$git_dir" ]; then echo "rm -rf $git_dir" rm -rf "$git_dir" fi if [ -d "$full_path/src" ]; then rm -rf "$full_path/src" fi if [ -d "$full_path/pkg" ]; then rm -rf "$full_path/pkg" fi cd "$CWD" done echo "Ready" sleep 5 process=$(ps x | grep konsole | grep $0 | awk '{print $1}') if [ $(( "$process" + 0 )) -ne 0 ]; then kill $(ps x | grep konsole | grep $0 | awk '{print $1}') fi