-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapt-stuff
86 lines (84 loc) · 2.18 KB
/
apt-stuff
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
#! /bin/bash/
function view_dpkg_log()
{
log_type="$1" # e.g., "installed", "upgrade", or "remove"
echo "Do you want to see every program $log_type, or just the last few?"
select view_choice in "All" "Limited"; do
case "$view_choice" in
"All")
grep " $log_type" /var/log/dpkg.log
return
;;
"Limited")
echo "Enter how many lines you wish to see:"
read -r limitnumber
grep " $log_type" /var/log/dpkg.log | tail -n "$limitnumber"
return
;;
esac
done
}
function apt-stuff()
{
clear
select apt_choice in "Edit APT Preferences" "Edit Sources" "Install Build Dependencies" "Add Keys" "APT History"; do
case "$apt_choice" in
"Edit APT Preferences")
echo "Tweaking APT Preferences can lead to system instability. Be careful out there!"
pressanykey
sudo nano /etc/apt/preferences
return
;;
"Edit Sources")
echo "Tweaking sources can lead to system instability. Be careful out there!"
pressanykey
sudo nano /etc/apt/sources.list
return
;;
"Install Build Dependencies")
sudo aptitude install debhelper devscripts build-essential
return
;;
"Add Keys")
echo "This script MUST be run as root. You will be prompted for your password later."
echo "Would you like to add an 8-digit key or a keyfile?"
select key_choice in "8-Digit Key" "Keyfile"; do
case "$key_choice" in
"8-Digit Key")
echo -n "Enter the pub key: "
read -r key
echo -n "Enter the keyserver URL: "
read -r keyserver
sudo apt-key adv --keyserver "$keyserver" --recv-keys "$key"
return
;;
"Keyfile")
echo -n "Enter the URL to the keyfile: "
read -r url
wget "$url" -O- | sudo apt-key add -
return
;;
esac
done
;;
"APT History")
select history_choice in "Installed Programs" "Upgraded Programs" "Removed Programs"; do
case "$history_choice" in
"Installed Programs")
view_dpkg_log "installed"
return
;;
"Upgraded Programs")
view_dpkg_log "upgrade"
return
;;
"Removed Programs")
view_dpkg_log "remove"
return
;;
esac
done
;;
esac
done
}