fix: 🐛 Install script fix

This commit is contained in:
Atsukoro1 2022-12-02 17:18:22 +01:00
parent efa52c72d3
commit f83079f707
2 changed files with 15 additions and 4 deletions

View file

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
function configure() {
echo "Configuring..."
rustup default stable
}
function makeDirectories() { function makeDirectories() {
echo "Creating required directories..." echo "Creating required directories..."
@ -20,9 +25,9 @@ function compile() {
function moveFiles() { function moveFiles() {
echo "Moving files..." echo "Moving files..."
if [ ! -f "/usr/bin/ponyfetch" ]; then rm -rf /usr/bin/ponyfetch
cp target/release/ponyfetch /usr/bin/ponyfetch rm -rf /bin/ponyfetch
fi cp ./target/release/ponyfetch /usr/bin/ponyfetch
toCopyCount=$(ls -1 /usr/share/ponyfetch/ponies/*.txt 2>/dev/null | wc -l) toCopyCount=$(ls -1 /usr/share/ponyfetch/ponies/*.txt 2>/dev/null | wc -l)
dirCount=$(ls -1 ponies/*.txt 2>/dev/null | wc -l) dirCount=$(ls -1 ponies/*.txt 2>/dev/null | wc -l)
@ -32,9 +37,15 @@ function moveFiles() {
fi fi
} }
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
echo "Thanks for choosing ponyfetch!" echo "Thanks for choosing ponyfetch!"
echo "Let's begin installing!" echo "Let's begin installing!"
configure
makeDirectories makeDirectories
compile compile
moveFiles moveFiles

View file

@ -9,7 +9,7 @@ pub struct Args {
/// Defines what ASCII pony to print. /// Defines what ASCII pony to print.
pub pony: String, pub pony: String,
#[clap(short, long, required = false, default_value = "0")] #[clap(short, long, required = false, default_value = "green")]
/// Defines what color to print the output it /// Defines what color to print the output it
pub color: String pub color: String
} }