OSDN Git Service

add instantinstall
[instantos/instantOS.git] / programs / instantinstall
1 #!/bin/bash
2
3 # program that prompts the user to install a package if it is not already installed
4
5 if [ -z "$1" ]; then
6     echo "no package to check"
7     exit
8 fi
9
10 checkpackage() {
11     if command -v "$1" || pacman -Qi "$1"; then
12         echo "package $1 found"
13         exit
14     fi
15     return 1
16 }
17
18 checkpackage "$1"
19
20 if ! checkinternet; then
21     imenu -e "internet is required"
22     exit 1
23 fi
24
25 if ! imenu -c "the extra package $1 is required. Download now?"; then
26     echo "package will not be installed"
27     exit 1
28 fi
29
30 st -e "bash" -c "sudo pacman -S --needed --noconfirm $1 && exit"
31
32 checkpackage "$1" || exit 1