mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-25 04:24:33 -04:00
Add files via upload
This commit is contained in:
parent
74e99e609a
commit
ebe7a817d4
2 changed files with 254 additions and 0 deletions
132
Bibata_installer.sh
Normal file
132
Bibata_installer.sh
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
show_question() {
|
||||||
|
echo -e "\033[1;34m$@\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_dir() {
|
||||||
|
echo -e "\033[1;32m$@\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_error() {
|
||||||
|
echo -e "\033[1;31m$@\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
end() {
|
||||||
|
echo -e "\nExiting...\n"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
continue() {
|
||||||
|
show_question "\nDo you want to continue? (Y)es, (N)o : \n"
|
||||||
|
read INPUT
|
||||||
|
case $INPUT in
|
||||||
|
[Yy]* ) ;;
|
||||||
|
[Nn]* ) end;;
|
||||||
|
* ) show_error "\nSorry, try again."; continue;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
replace() {
|
||||||
|
show_question "\nFound an existing installation. Replace it? (Y)es, (N)o :\n"
|
||||||
|
read INPUT
|
||||||
|
case $INPUT in
|
||||||
|
[Yy]* ) rm -rf "$@/Bibata" 2>/dev/null;;
|
||||||
|
[Nn]* ) ;;
|
||||||
|
* ) show_error "\tSorry, try again."; replace $@;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
|
||||||
|
# PREVIEW
|
||||||
|
|
||||||
|
# Show destination directory
|
||||||
|
echo -e "\nBibata Cursor Theme will be installed in:\n"
|
||||||
|
show_dir "\t$DEST_DIR"
|
||||||
|
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||||
|
echo -e "\nIt will be available to all users."
|
||||||
|
else
|
||||||
|
echo -e "\nTo make them available to all users, run this script as root."
|
||||||
|
fi
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
|
# INSTALL
|
||||||
|
|
||||||
|
# Check destination directory
|
||||||
|
if [ ! -d $DEST_DIR ]; then
|
||||||
|
mkdir -p $DEST_DIR
|
||||||
|
elif [[ -d $DEST_DIR/Bibata ]]; then
|
||||||
|
replace $DEST_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\nInstalling Bibata..."
|
||||||
|
|
||||||
|
# Copying files
|
||||||
|
cp -rf Bibata $DEST_DIR
|
||||||
|
chmod -R 755 $DEST_DIR/Bibata
|
||||||
|
|
||||||
|
echo "Installation complete!"
|
||||||
|
echo "Do not forget you have to set Bibata Cursor."
|
||||||
|
}
|
||||||
|
|
||||||
|
remove() {
|
||||||
|
|
||||||
|
# PREVIEW
|
||||||
|
|
||||||
|
# Show installation directory
|
||||||
|
if [[ -d $DEST_DIR/Bibata ]]; then
|
||||||
|
echo -e "\nBibata Cursor Theme installed in:\n"
|
||||||
|
show_dir "\t$DEST_DIR"
|
||||||
|
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||||
|
echo -e "\nIt will remove for all users."
|
||||||
|
else
|
||||||
|
echo -e "\nIt will remove only for current user."
|
||||||
|
fi
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
|
else
|
||||||
|
show_error "\nBibata Cursor is not installed in:\n"
|
||||||
|
show_dir "\t$DEST_DIR\n"
|
||||||
|
end
|
||||||
|
fi
|
||||||
|
|
||||||
|
# REMOVE
|
||||||
|
|
||||||
|
echo -e "\nRemoving Bibata..."
|
||||||
|
|
||||||
|
# Removing files
|
||||||
|
rm -rf $DEST_DIR/Bibata
|
||||||
|
|
||||||
|
echo "Removing complete!"
|
||||||
|
echo "I hope to see you soon."
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
show_question "What you want to do: (I)nstall, (R)emove : \n"
|
||||||
|
read INPUT
|
||||||
|
case $INPUT in
|
||||||
|
[Ii]* ) install;;
|
||||||
|
[Rr]* ) remove;;
|
||||||
|
* ) show_error "\nSorry, try again."; main;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ROOT_UID=0
|
||||||
|
DEST_DIR=
|
||||||
|
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
|
||||||
|
|
||||||
|
# Destination directory
|
||||||
|
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||||
|
DEST_DIR="/usr/share/icons"
|
||||||
|
else
|
||||||
|
DEST_DIR="$HOME/.local/share/icons"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\e[1m\n+---------------------------------------------+"
|
||||||
|
echo -e "| Bibata Cursor Installer Script |"
|
||||||
|
echo -e "+---------------------------------------------+\n\e[0m"
|
||||||
|
|
||||||
|
main
|
122
build.sh
Normal file
122
build.sh
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
|
||||||
|
RAWSVGS_Bibata="src/Bibata/svgs"
|
||||||
|
INDEX_Bibata="src/Bibata/cursor.theme"
|
||||||
|
INDEX1_Bibata="src/Bibata/index.theme"
|
||||||
|
ALIASES="src/cursorList"
|
||||||
|
|
||||||
|
|
||||||
|
echo -ne "Checking Requirements...\\r"
|
||||||
|
|
||||||
|
if ! type "inkscape" > /dev/null ; then
|
||||||
|
echo -e "\\nFAIL: inkscape must be installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! type "xcursorgen" > /dev/null ; then
|
||||||
|
echo -e "\\nFAIL: xcursorgen must be installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "Checking Requirements... DONE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo -ne "Making Folders... $BASENAME\\r"
|
||||||
|
DIR2X_Bibata="build/Bibata/x2"
|
||||||
|
DIR1X_Bibata="build/Bibata/x1"
|
||||||
|
OUTPUT_Bibata="$(grep --only-matching --perl-regex "(?<=Name\=).*$" $INDEX_Bibata)"
|
||||||
|
OUTPUT_Bibata=${OUTPUT_Bibata// /_}
|
||||||
|
mkdir -p "$DIR2X_Bibata"
|
||||||
|
mkdir -p "$DIR1X_Bibata"
|
||||||
|
mkdir -p "$OUTPUT_Bibata/cursors"
|
||||||
|
echo 'Making Folders... DONE';
|
||||||
|
|
||||||
|
|
||||||
|
for CUR in src/config/*.cursor; do
|
||||||
|
BASENAME=$CUR
|
||||||
|
BASENAME=${BASENAME##*/}
|
||||||
|
BASENAME=${BASENAME%.*}
|
||||||
|
|
||||||
|
echo -ne "\033[0KGenerating simple cursor pixmaps... $BASENAME\\r"
|
||||||
|
|
||||||
|
inkscape -w 32 -f $RAWSVGS_Bibata/"$BASENAME".svg -e "$DIR1X_Bibata/$BASENAME.png" > /dev/null
|
||||||
|
inkscape -w 64 -f $RAWSVGS_Bibata/"$BASENAME".svg -e "$DIR2X_Bibata/$BASENAME.png" > /dev/null
|
||||||
|
done
|
||||||
|
echo -e "\033[0KGenerating simple cursor pixmaps... DONE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||||
|
do
|
||||||
|
echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 31 \\r"
|
||||||
|
|
||||||
|
inkscape -w 32 -f $RAWSVGS_Bibata/progress-$i.svg -e "$DIR1X_Bibata/progress-$i.png" > /dev/null
|
||||||
|
inkscape -w 64 -f $RAWSVGS_Bibata/progress-$i.svg -e "$DIR2X_Bibata/progress-$i.png" > /dev/null
|
||||||
|
|
||||||
|
inkscape -w 32 -f $RAWSVGS_Bibata/wait-$i.svg -e "$DIR1X_Bibata/wait-$i.png" > /dev/null
|
||||||
|
inkscape -w 64 -f $RAWSVGS_Bibata/wait-$i.svg -e "$DIR2X_Bibata/wait-$i.png" > /dev/null
|
||||||
|
done
|
||||||
|
echo -e "\033[0KGenerating animated cursor pixmaps... DONE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo -ne "Generating cursor theme...\\r"
|
||||||
|
for CUR in src/config/*.cursor; do
|
||||||
|
BASENAME=$CUR
|
||||||
|
BASENAME=${BASENAME##*/}
|
||||||
|
BASENAME=${BASENAME%.*}
|
||||||
|
|
||||||
|
ERR="$( xcursorgen -p build/Bibata "$CUR" "$OUTPUT_Bibata/cursors/$BASENAME" 2>&1 )"
|
||||||
|
|
||||||
|
if [[ "$?" -ne "0" ]]; then
|
||||||
|
echo "FAIL: $CUR $ERR"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo -e "Generating cursor theme... DONE"
|
||||||
|
|
||||||
|
|
||||||
|
echo -ne "Generating shortcuts...\\r"
|
||||||
|
while read -r ALIAS ; do
|
||||||
|
FROM=${ALIAS% *}
|
||||||
|
TO=${ALIAS#* }
|
||||||
|
|
||||||
|
if [ -e "$OUTPUT_Bibata/cursors/$FROM" ] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
ln -sf "$TO" "$OUTPUT_Bibata/cursors/$FROM"
|
||||||
|
done < $ALIASES
|
||||||
|
echo -e "\033[0KGenerating shortcuts... DONE"
|
||||||
|
|
||||||
|
echo -ne "Copying Theme Index...\\r"
|
||||||
|
|
||||||
|
if ! [ -e "$OUTPUT_Bibata/$INDEX_Bibata" ] ; then
|
||||||
|
cp $INDEX_Bibata "$OUTPUT_Bibata/cursor.theme"
|
||||||
|
cp $INDEX1_Bibata "$OUTPUT_Bibata/index.theme"
|
||||||
|
fi
|
||||||
|
echo -e "\033[0KCopying Theme Index... DONE"
|
||||||
|
|
||||||
|
|
||||||
|
echo -ne "Generating Installer...\\r"
|
||||||
|
if ! [ -e "$OUTPUT_Bibata/$INDEX_Bibata" ] ; then
|
||||||
|
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
|
||||||
|
cp src/in.inst Bibata_installer.sh
|
||||||
|
fi
|
||||||
|
echo -e "\033[0KGenerating Installer... DONE"
|
||||||
|
|
||||||
|
echo -ne "Making Installer Executable...\\r"
|
||||||
|
if ! [ -e "$OUTPUT_Bibata/$INDEX_Bibata" ] ; then
|
||||||
|
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
|
||||||
|
gksu chmod +x Bibata_installer.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
show_Msg() {
|
||||||
|
echo -e "\033[1;34m$@\033[0m"
|
||||||
|
}
|
||||||
|
echo -e "\033[0KMaking Installer Executable... DONE"
|
||||||
|
|
||||||
|
show_Msg "For Installation Use Following Command:\n ./Bibata_installer.sh"
|
||||||
|
exit
|
||||||
|
|
||||||
|
echo "COMPLETE!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue