ponyfetch/install.sh
2022-12-02 17:01:24 +01:00

40 lines
No EOL
869 B
Bash
Executable file

#!/bin/bash
function makeDirectories() {
echo "Creating required directories..."
if [ ! -d "/usr/share/ponyfetch" ]; then
mkdir /usr/share/ponyfetch
mkdir /usr/share/ponyfetch/ponies
fi
}
function compile() {
echo "Compiling ponyfetch..."
if [ ! -f "/usr/bin/ponyfetch" ]; then
cargo build --release
fi
}
function moveFiles() {
echo "Moving files..."
if [ ! -f "/usr/bin/ponyfetch" ]; then
cp target/release/ponyfetch /usr/bin/ponyfetch
fi
toCopyCount=$(ls -1 /usr/share/ponyfetch/ponies/*.txt 2>/dev/null | wc -l)
dirCount=$(ls -1 ponies/*.txt 2>/dev/null | wc -l)
if [ $toCopyCount != $dirCount ]; then
cp -r ponies/* /usr/share/ponyfetch/ponies
fi
}
echo "Thanks for choosing ponyfetch!"
echo "Let's begin installing!"
makeDirectories
compile
moveFiles