2022-12-02 17:01:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-12-02 17:18:22 +01:00
|
|
|
function configure() {
|
|
|
|
echo "Configuring..."
|
|
|
|
rustup default stable
|
|
|
|
}
|
|
|
|
|
2022-12-02 17:01:24 +01:00
|
|
|
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..."
|
|
|
|
|
2022-12-02 17:18:22 +01:00
|
|
|
rm -rf /usr/bin/ponyfetch
|
|
|
|
rm -rf /bin/ponyfetch
|
|
|
|
cp ./target/release/ponyfetch /usr/bin/ponyfetch
|
2022-12-02 17:01:24 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2022-12-02 17:18:22 +01:00
|
|
|
if [ "$EUID" -ne 0 ]
|
|
|
|
then echo "Please run as root"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2022-12-02 17:01:24 +01:00
|
|
|
echo "Thanks for choosing ponyfetch!"
|
|
|
|
echo "Let's begin installing!"
|
|
|
|
|
2022-12-02 17:18:22 +01:00
|
|
|
configure
|
2022-12-02 17:01:24 +01:00
|
|
|
makeDirectories
|
|
|
|
compile
|
|
|
|
moveFiles
|