mirror of
https://github.com/byReqz/blackmate.git
synced 2024-11-23 19:54:55 +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:
parent
9551a8b660
commit
bd594e4060
42
blackmate.sh
42
blackmate.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/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.
|
# 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.
|
# 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
|
#Check if the script have the root permission
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Blackmate must run with root permission (use sudo or the script will fail)"
|
printf 'Blackmate must run with root permission (use sudo or the script will fail)';
|
||||||
exit 1
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "[*] Creating the new menu entry\n";
|
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
|
for u in $( ls --color=auto /usr/share/blackmate/menu-i/ | sort ); do
|
||||||
|
|
||||||
c=`echo $u | sed 's/BlackArch-//' | sed 's/\.png//'`;
|
c=`echo $u | sed 's/BlackArch-//' | sed 's/\.png//'`;
|
||||||
|
|
||||||
cat /usr/share/blackmate/dfdir | sed 's/^Name=.*/Name='$c'/' |
|
cat /usr/share/blackmate/dfdir | sed 's/^Name=.*/Name='$c'/' |
|
||||||
sed 's/^Icon=.*/Icon=BlackArch-'$c'/' > /usr/share/desktop-directories/BlackArch-$c.directory
|
sed 's/^Icon=.*/Icon=BlackArch-'$c'/' > /usr/share/desktop-directories/BlackArch-$c.directory
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#Fetch the current icons theme in use
|
||||||
printf "[*] Update the icons theme in use\n";
|
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 |
|
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 ' '`;
|
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
|
#Copy the extra icons into the icons theme
|
||||||
cp /usr/share/blackmate/menu-i/* /usr/share/icons/$thic/32x32/apps/ 2> /dev/null || true
|
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
|
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
|
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
|
#Download and generate the latest tools list
|
||||||
|
printf "[*] Download the tools list, please wait...\n";
|
||||||
|
|
||||||
mkdir /usr/share/blackmate/tmp
|
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
|
tar -zxf /usr/share/blackmate/blackarch.db.tar.gz -C /usr/share/blackmate/tmp
|
||||||
|
|
||||||
#Terminal to use for the blackarch entry
|
#Terminal to use for the blackarch entry
|
||||||
@ -170,7 +176,7 @@ fi
|
|||||||
|
|
||||||
namecat=`echo X-BlackArch-Misc;`;
|
namecat=`echo X-BlackArch-Misc;`;
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#For each tools of the target categorie
|
#For each tools of the target categorie
|
||||||
for i in $tname; do
|
for i in $tname; do
|
||||||
@ -185,16 +191,16 @@ fi
|
|||||||
#End of the current tool
|
#End of the current tool
|
||||||
done
|
done
|
||||||
|
|
||||||
#End of the current categorie
|
#End of the current categorie
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "[*] Cleanup...\n";
|
printf "[*] Cleanup...\n";
|
||||||
|
|
||||||
#Move the .desktop to the right directory
|
#Move the .desktop to the right directory
|
||||||
mv /usr/share/blackmate/ba-*.desktop /usr/share/applications
|
mv /usr/share/blackmate/ba-*.desktop /usr/share/applications
|
||||||
|
|
||||||
#Delete tmp directory
|
#Delete tmp directory
|
||||||
rm -rf /usr/share/blackmate/tmp/
|
rm -rf /usr/share/blackmate/tmp/
|
||||||
rm /usr/share/blackmate/blackarch.db.tar.gz
|
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";
|
||||||
|
Loading…
Reference in New Issue
Block a user