-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
55 lines (41 loc) · 1.1 KB
/
setup.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
#! /bin/bash
set -e
declare -r scriptdir=$(dirname $(readlink -ef $0))
declare -r username=$(logname)
source conf/env
source lib/common
if [[ $EUID -ne 0 ]] ; then
die "Root privilege is required to run setup script"
fi
[[ -n $username ]] || die "Can't get usename from setup script"
packages=(
build-essential
cowbuilder
devscripts
eatmydata
git
# git-review
git-buildpackage
tmux
quilt
dput
)
sudoers=examples/sudoers
info "Install required packages"
apt-get install -y ${packages[@]}
if [[ -f ${sudoers} ]] ; then
info "Install sudoers configuration"
install -m 600 -v $sudoers /etc/sudoers.d/deepin_pbuilder
sed -e "s/deepin/$username/" -i /etc/sudoers.d/deepin_pbuilder
fi
info "create executable link"
ln -sfv ${scriptdir}/cowimage /usr/local/bin
ln -sfv ${scriptdir}/pkgbuilder /usr/local/bin
info "copy apt key"
cp -av /etc/apt/trusted.gpg.d/ ${scriptdir}/apt
info "Remove old executable"
rm -f /usr/local/bin/deepin-buildpackage
mkdir -pv ${ARTIFACTS}
info "Change folder permission"
chown $(logname). -v ${ARTIFACTS}
chown $(logname). -vR ${scriptdir}