forked from ej52/proxmox-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian.sh
48 lines (38 loc) · 801 Bytes
/
debian.sh
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
#!/usr/bin/env bash
os_arch() {
printf $(dpkg --print-architecture)
}
os_codename() {
printf $(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)
}
os_version() {
printf $(awk -F'=' '/^VERSION_ID=/{ print $NF }' /etc/os-release)
}
pkg_update() {
apt-get -y -qq update >$__OUTPUT
}
pkg_upgrade() {
apt-get -y -qq upgrade >$__OUTPUT
}
pkg_add() {
apt-get -y -qq --no-install-recommends install $@ >$__OUTPUT
}
pkg_del() {
apt-get -y -qq purge $@ >$__OUTPUT
}
pkg_clean() {
apt-get -y -qq autoremove >$__OUTPUT
apt-get clean >$__OUTPUT
}
svc_add() {
systemctl daemon-reload >$__OUTPUT
systemctl stop $@ &>$__OUTPUT
sleep 2
systemctl enable --now $@ >$__OUTPUT
}
svc_start() {
systemctl start $@ >$__OUTPUT
}
svc_stop() {
systemctl stop $@ >$__OUTPUT
}