1
0
mirror of https://github.com/byReqz/blackmate.git synced 2024-11-23 11:44:56 +00:00

Minor bug fixed + clean of the script

Tested as this day on a fresh xface4 install, works as expected whatever the theme in use.

A small bug occur on my env, the icons of the categorie Audit and Windows won't display, thanks for any feedback about this script in your env
This commit is contained in:
Anyon3 2016-09-25 19:13:53 +08:00 committed by GitHub
parent 9551a8b660
commit bd594e4060

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Blackmate v0.4
# Blackmate v0.41
#
# Description : BlackMate is a menu generator for the BlackArch Linux os tools, made for the wm xfce4.
# It will fetch the latest database of BlackArch and create an entry for each of them in the menu.
@ -14,8 +14,8 @@
#Check if the script have the root permission
if [[ $EUID -ne 0 ]]; then
echo "Blackmate must run with root permission (use sudo or the script will fail)"
exit 1
printf 'Blackmate must run with root permission (use sudo or the script will fail)';
exit 1;
fi
printf "[*] Creating the new menu entry\n";
@ -34,18 +34,24 @@ fi
for u in $( ls --color=auto /usr/share/blackmate/menu-i/ | sort ); do
c=`echo $u | sed 's/BlackArch-//' | sed 's/\.png//'`;
cat /usr/share/blackmate/dfdir | sed 's/^Name=.*/Name='$c'/' |
sed 's/^Icon=.*/Icon=BlackArch-'$c'/' > /usr/share/desktop-directories/BlackArch-$c.directory
done
#Fetch the current icons theme in use
printf "[*] Update the icons theme in use\n";
#Fetch the current icons theme in use
if [[ -f /home/$SUDO_USER/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml ]]; then
thic=`cat /home/$SUDO_USER/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml | grep IconThemeName |
sed 's/<property name="IconThemeName" type="string" value\="//' | tr -d '"/>' | tr -d ' '`;
#If the file do not exist, we assume the current theme is the default one (gnome)
else
thic=`echo gnome`;
fi
#Copy the extra icons into the icons theme
cp /usr/share/blackmate/menu-i/* /usr/share/icons/$thic/32x32/apps/ 2> /dev/null || true
@ -53,11 +59,11 @@ fi
chown $SUDO_USER:$SUDO_USER /usr/share/icons/$thic/32x32/apps/ -R 2> /dev/null || true
chmod 755 /usr/share/icons/$thic/32x32/apps/ -R 2> /dev/null || true
printf "[*] Download the tools list\n";
#Download and generate the latest tools list
printf "[*] Download the tools list, please wait...\n";
mkdir /usr/share/blackmate/tmp
wget -P /usr/share/blackmate/ https://mirror.yandex.ru/mirrors/blackarch/blackarch/os/x86_64/blackarch.db.tar.gz
wget -q -P /usr/share/blackmate/ https://mirror.yandex.ru/mirrors/blackarch/blackarch/os/x86_64/blackarch.db.tar.gz
tar -zxf /usr/share/blackmate/blackarch.db.tar.gz -C /usr/share/blackmate/tmp
#Terminal to use for the blackarch entry
@ -170,7 +176,7 @@ fi
namecat=`echo X-BlackArch-Misc;`;
fi
fi
#For each tools of the target categorie
for i in $tname; do
@ -185,16 +191,16 @@ fi
#End of the current tool
done
#End of the current categorie
done
#End of the current categorie
done
printf "[*] Cleanup...\n";
printf "[*] Cleanup...\n";
#Move the .desktop to the right directory
mv /usr/share/blackmate/ba-*.desktop /usr/share/applications
#Move the .desktop to the right directory
mv /usr/share/blackmate/ba-*.desktop /usr/share/applications
#Delete tmp directory
rm -rf /usr/share/blackmate/tmp/
rm /usr/share/blackmate/blackarch.db.tar.gz
#Delete tmp directory
rm -rf /usr/share/blackmate/tmp/
rm /usr/share/blackmate/blackarch.db.tar.gz
echo "[*] Done";
echo "[*] Done, in order to have a correct display of the new menu, you may need to restart xfce4";