This repository has been archived by the owner on Jul 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
debify.sh
executable file
·75 lines (59 loc) · 1.81 KB
/
debify.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
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
if [ ! -d /debs ]
then
echo "Mount your Debian package directory to /debs."
exit 1
fi
APTLY_REPO_NAME=debify
aptly repo create \
-component="$APTLY_COMPONENT" \
-distribution="$APTLY_DISTRIBUTION" \
$APTLY_REPO_NAME
aptly repo add $APTLY_REPO_NAME /debs/
aptly repo show $APTLY_REPO_NAME
if [ ! -z "$GPG_PASSPHRASE" ]
then
passphrase="$GPG_PASSPHRASE"
elif [ ! -z "$GPG_PASSPHRASE_FILE" ]
then
passphrase=$(<$GPG_PASSPHRASE_FILE)
fi
aptly publish repo \
-architectures="$APTLY_ARCHITECTURES" \
-passphrase="$passphrase" \
$APTLY_REPO_NAME
mv ~/.aptly/public /repo
if [ ! -z "$KEYSERVER" ] && [ ! -z "$URI" ]
then
release_sig_path=$(find /repo/dists -name Release.gpg | head -1)
gpg_key_id=$(gpg --list-packets $release_sig_path | grep -oP "(?<=keyid ).+")
echo "# setup script for $URI" > /repo/go
case "$URI" in
https://*)
cat >> /repo/go <<-END
if [ ! -e /usr/lib/apt/methods/https ]
then
apt-get update
apt-get install -y apt-transport-https
fi
END
esac
cat >> /repo/go <<-END
apt-key adv --keyserver $KEYSERVER --recv-keys $gpg_key_id
echo "deb $URI $APTLY_DISTRIBUTION $APTLY_COMPONENT" >> /etc/apt/sources.list
apt-get update
END
fi
tar -C /repo -czf /debs/repo.tar.gz .