-
Notifications
You must be signed in to change notification settings - Fork 0
/
aptinst
91 lines (72 loc) · 2.14 KB
/
aptinst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#Color Variables
NC='\e[0m'
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
WHITE='\e[1;37m'
ORANGE='\e[0;33m'
BLUE='\e[0;34m'
PURPLE='\e[0;35m'
CYAN='\e[0;36m'
YELLOW='\e[1;33m'
DARGRAY='\e[1;30m'
#Lighter Colors
LIGRAY='\e[0;37m'
LIGREEN='\e[1;32m'
LIRED='\e[1;31m'
LIBLUE='\e[1;34m'
LIPURPLE='\e[1;35m'
LICYAN='\e[1;36m'
#Background Color Variables
BACKBLACK='\e[0;40m'
BACKRED='\e[0;41m'
BACKGREEN='\e[0;42m'
BACKWHITE='\e[1;47m'
BACKORANGE='\e[0;43m'
BACKBLUE='\e[0;44m'
BACKPURPLE='\e[0;45m'
BACKCYAN='\e[0;46m'
BACKYELLOW='\e[1;43m'
#Lighter Colors
BACKLIGRAY='\e[0;47m'
BACKLIGREEN='\e[1;42m'
BACKLIRED='\e[1;41m'
BACKLIBLUE='\e[1;44m'
BACKLIPURPLE='\e[1;45m'
BACKLICYAN='\e[1;46m'
#Markup Variables
UNDERLINE='\e[4m'
DOUBLEUNDERLINE='\e[21m'
BOLD='\e[1m'
BLINK='\e[5m'
REVVID='\e[7m'
aptinst_norm() {
if [ "$@" == "" ]; then
printf "\n${RED}${BOLD}Error: ${RED}No packages detected! Try putting some package names after 'aptinst'.${NC}\n\n"; exit 1
fi
if ! wget --spider https://github.com &>/dev/null; then
printf "\n${YELLOW}${BOLD}Warning: I tried to contact ${BLUE}${BOLD}https://github.com${YELLOW} but it did not respond! If you are installing new packages from the internet, you will probably encounter errors!"
fi
printf "\n\n${CYAN}Installing packages:${WHITE} "; echo "$*"
printf "${NC}\n"
sudo apt install $*
}
aptinst_verb() {
printf "\n${CYAN}Checking to make sure you specified some packages...${NC}\n"
if [ "sudo apt install " > "sudo apt install $*" ]; then
printf "\n${RED}${BOLD}Error: ${RED}No packages detected! Try putting some package names after 'aptinst'.${NC}\n\n"; exit 1
fi
printf "\n${CYAN}Checking to make sure you have internet...${NC}\n\n"
if wget --spider https://github.com; then
printf "\n${YELLOW}${BOLD}Warning: I tried to contact ${BLUE}${BOLD}https://github.com${YELLOW} but it did not respond! If you are installing new packages from the internet, you will probably encounter errors!"
fi
printf "\n\n${CYAN}Installing packages:${WHITE} "; echo "$*"
printf "${NC}\n"
sudo apt install $*
}
case $1 in
--verbose|-v) aptinst_verb ;;
--help|-h) ;;#aptinst-help ;;
*) aptinst_norm ;;
esac