diff options
Diffstat (limited to 'cron-jobs/make_repo_torrents')
-rwxr-xr-x | cron-jobs/make_repo_torrents | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 767e182..739419c 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -20,14 +20,14 @@ username=$( id -un ) case "${username}" in - repo | root ) - true - ;; - * ) - echo "This script must be run as repo user or root user." - echo "ByeBye!" - exit 1 - ;; + repo | root ) + true + ;; + * ) + echo "This script must be run as repo user or root user." + echo "ByeBye!" + exit 1 + ;; esac # pacman doesn't support multiple different packages of the same name, @@ -43,28 +43,28 @@ pkgfilelist=$(mktemp) # Find any directories that might have packages in them find "${public_location}" -name 'os' -type 'd' | - while read dir - do - # Find any packages - find "${dir}" -regex '[^ ]+\.pkg\.tar\.xz' - done > "${pkgfilelist}" + while read dir + do + # Find any packages + find "${dir}" -regex '[^ ]+\.pkg\.tar\.xz' + done > "${pkgfilelist}" while read pkg do - pkg_name="${pkg##*/}" + pkg_name="${pkg##*/}" - if [[ -h "${pkg}" ]] # check if it's a symbolic link - then - # We get the target of the symlink - pkg=$( readlink -f "${pkg}" ) - fi + if [[ -h "${pkg}" ]] # check if it's a symbolic link + then + # We get the target of the symlink + pkg=$( readlink -f "${pkg}" ) + fi - # If a .torrent file does not already exist for this package, we call - # `make_individual_torrent' to make it. - if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] - then - "$script_directory/make_individual_torrent" "${pkg}" "${public_location}" - fi + # If a .torrent file does not already exist for this package, we call + # `make_individual_torrent' to make it. + if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] + then + "$script_directory/make_individual_torrent" "${pkg}" "${public_location}" + fi done < "${pkgfilelist}" # For torrents older than 1 year, we check if it's package still @@ -74,19 +74,19 @@ done < "${pkgfilelist}" # probability. if ! (( $(shuf -e {0..29} | head -1) )) then - find -H "${torrent_location}" -mtime +365 -name '*.torrent' -type f | - while read oldtorrent - do - oldtorrentnm="${oldtorrent##*/}" - correspackagenm="${oldtorrentnm%.torrent}" - - grep "${correspackagenm}" "${pkgfilelist}" &> /dev/null || rm "${oldtorrent}" - done + find -H "${torrent_location}" -mtime +365 -name '*.torrent' -type f | + while read oldtorrent + do + oldtorrentnm="${oldtorrent##*/}" + correspackagenm="${oldtorrentnm%.torrent}" + + grep "${correspackagenm}" "${pkgfilelist}" &> /dev/null || rm "${oldtorrent}" + done fi if [[ "${username}" == root ]] then - chown repo * + chown repo * fi rm -f "${pkgfilelist}" |