-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfunctions.sh
More file actions
85 lines (73 loc) · 1.85 KB
/
functions.sh
File metadata and controls
85 lines (73 loc) · 1.85 KB
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
#!/bin/bash
# color defination (ascii)
red="\e[1;31m"
green="\e[1;32m"
yellow="\e[1;33m"
blue="\e[1;34m"
megenta="\e[1;1;35m"
cyan="\e[1;36m"
orange="\x1b[38;5;214m"
end="\e[1;0m"
# cache dir
dir="$(dirname "$(realpath "$0")")"
# display msge
display_text() {
clear && sleep 1
cat << "EOF"
Welcome to the' 'i3 wm installation script by,
_____ __ __ __ _ __ _ _
/ ___/ / /_ ___ / // / / | / /(_)____ (_)____ _
\__ \ / __ \ / _ \ / // / / |/ // // __ \ / // __ `/
___/ // / / // __// // / / /| // // / / / / // /_/ /
/____//_/ /_/ \___//_//_/ /_/ |_//_//_/ /_/__/ / \__,_/
/___/
EOF
}
# function for printing message
msg() {
local actn="$1"
local msg="$2"
case $actn in
act)
printf "${green}=>${end} $msg\n"
;;
ask)
printf "${orange}??${end} $msg\n"
;;
dn)
printf "\n${cyan}::${end} $msg\n\n"
;;
att)
printf "${yellow}!!${end} $msg\n"
;;
warn)
printf "${yellow}[ WARNING ]${end}\n $msg\n"
;;
wrng)
printf "${red}[ WRONG ]${end}\n $msg\n"
;;
nt)
printf "${blue}\$\$${end} $msg\n"
;;
skp)
printf "${magenta}[ SKIP ]${end} $msg\n"
;;
err)
printf "\n${red}>< Ohh sheet! an error..${end}\n $msg\n"
sleep 1
;;
*)
printf "$msg\n"
;;
esac
}
# check package manager
check_pkgman() {
if command -v pacman &> /dev/null; then
pkgman="pacman"
elif command -v apt &> /dev/null; then
pkgman="apt"
fi
. /etc/os-release
msg act "Starting the script for ${cyan}$NAME${end} using '${pkgman}'"
}