Last active
April 19, 2016 03:05
-
-
Save Brli/e9355cd1f072720cf9a6c3de63654d79 to your computer and use it in GitHub Desktop.
Modified version of chakra-check-links in terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check_links.sh | |
# | |
# Copyright © 2015 Samir Benmendil <chakra@rmz.io> | |
# Copyright © 2011-2012 Manuel Tortosa <manutortosa[at]chakra-project[dot]org> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, see <http://www.gnu.org/licenses/>. | |
checkso() { | |
for f in ${@}; do | |
inc=$((`qdbus $dbusRef Get "" "value"` + 1)) | |
qdbus $dbusRef Set "" value $inc > /dev/null; | |
if sudo ldd $f | grep -q "not found"; then | |
out+="$(LC_ALL=C pacman -Qoq $f) $f seems missing `sudo ldd $f | grep found | cut -d . -f 1-2` \n\n" | |
fi | |
done | |
qdbus $dbusRef close | |
kdialog --msgbox "$out" | |
} | |
sudo -v | |
dbusRef=$(kdialog --title "Chakra Check Links" --progressbar "Searching for broken binaries"); | |
bins=( $(find /usr/bin -maxdepth 1 -type f -executable) ) | |
qdbus $dbusRef Set "" maximum ${#bins[@]} > /dev/null; | |
checkso ${bins[@]} | |
dbusRef=$(kdialog --title "Chakra Check Links" --progressbar "Searching for broken libs"); | |
#libs=( $(find /usr/lib/*.so* -maxdepth 1 -type f -executable) ) | |
libs=($(pacman -Ql | grep -F .so | cut -d' ' -f 2)) | |
qdbus $dbusRef Set "" maximum ${#libs[@]} > /dev/null; | |
checkso ${libs[@]} | |
qdbus $dbusRef close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment