From 9a46844693909ac5c82298d98ec81a75304e1e5a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 3 Apr 2018 14:50:41 +0200 Subject: substitute bin/wtf by pkgfile --- bin/wtf | 59 ----------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100755 bin/wtf (limited to 'bin/wtf') diff --git a/bin/wtf b/bin/wtf deleted file mode 100755 index 4c03103..0000000 --- a/bin/wtf +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -# usage: wtf $file - -# Find out what package provides the given file. -# $file may be a single file name or an absolute path. - -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" - -hash=$( - printf '%d' "0x$( - printf '%s' "$*" | \ - sed ' - s,/$,, - s,.*/,, - ' | \ - sha224sum | \ - awk '{print $1}' | \ - cut -c 1-4 - )" -) - -partition=$((hash % mysql_files_table_partitions)) - -result=$( - # shellcheck disable=SC2016 - { - printf 'SELECT DISTINCT CONCAT(`repositories`.`name`,"/",' - mysql_package_name_query - printf ')' - printf ' FROM `binary_packages`' - mysql_join_binary_packages_architectures - mysql_join_binary_packages_repositories - printf ' JOIN `file_providers` PARTITION (p%s) ON `file_providers`.`package`=`binary_packages`.`id`' \ - "${partition}" - printf ' JOIN `files` PARTITION (p%s) ON `files`.`id`=`file_providers`.`file` AND `files`.`name_hash`=`file_providers`.`file_name_hash`' \ - "${partition}" - printf ' WHERE `files`.`name_hash`=%s' \ - "${hash}" - printf ' AND (`files`.`name`=from_base64("%s")' \ - "$( - printf '%s' "$*" | \ - base64 -w0 - )" - printf ' OR CONCAT(`files`.`path`,`files`.`name`)=from_base64("%s"))' \ - "$( - printf '%s' "$*" | \ - base64 -w0 - )" - } | \ - mysql_run_query -) - -if [ -z "${result}" ]; then - printf 'Huh, I don'"'"'t know that one.\n' -else - printf '%s\n' "${result}" -fi -- cgit v1.2.3