-
Notifications
You must be signed in to change notification settings - Fork 20
/
setup_skychart_deb.sh
executable file
·66 lines (57 loc) · 2.3 KB
/
setup_skychart_deb.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# work directory
workdir=$(mktemp -d -t)
if [[ -z $workdir ]]; then workdir=/tmp; fi
cd $workdir
#Patrick Chevalley key used to sign the Skychart packages
key=8B8B57C1AA716FC2
aptversion=$(/usr/bin/apt -v)
if [[ $? != 0 ]]; then
echo "This script is intended to setup the Skychart Debian package with apt."
echo "It look like this is not the case for your system."
exit
fi
echo "This script add the Skychart repository to simplify the installation and update of the software."
echo "It is possible to get the STABLE version that is updated every few year,"
echo "or the more frequently updated BETA version with the last features and corrections."
PS3='Please select the version you want: '
options=("Stable" "Beta" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Stable")
version=stable
break
;;
"Beta")
version=unstable
break
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
done
echo "You may now give your password for the sudo apt command."
sudo echo OK
if [[ $? != 0 ]]; then exit; fi
#First remove the existing key and repo list if it already exists
sudo apt-key del $key 2>/dev/null
sudo rm /etc/apt/sources.list.d/skychart.list 2>/dev/null
#Create the key with the right format for apt
rm skychart-temp-keyring.gpg $key.key 2>/dev/null
wget --no-verbose -O $key.key "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x$key"
if [[ $? != 0 ]]; then exit; fi
gpg --no-default-keyring --keyring ./skychart-temp-keyring.gpg --import $key.key
gpg --no-default-keyring --keyring ./skychart-temp-keyring.gpg --export --output skychart.gpg
if [[ $? != 0 ]]; then exit; fi
rm skychart-temp-keyring.gpg skychart-temp-keyring.gpg~ $key.key 2>/dev/null
#Install the key and set the new repo list:
sudo mkdir /usr/local/share/keyrings 2>/dev/null
sudo mv skychart.gpg /usr/local/share/keyrings/
sudo sh -c "echo deb [signed-by=/usr/local/share/keyrings/skychart.gpg] http://www.ap-i.net/apt $version main > /etc/apt/sources.list.d/skychart.list"
echo ""
echo "The repository is defined to use the $version packages."
echo "You can now use your prefered package manager to install Skychart."
echo "If you want to continue from the command line do not forget to run: sudo apt update"