forked from niko-dunixi/git-openssl-shellscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-openssl.sh
executable file
·67 lines (59 loc) · 1.68 KB
/
git-openssl.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
#!/usr/bin/env bash
# Gather command line options
for i in "$@"
do
case $i in
-skiptests|--skip-tests) # Skip tests portion of the build
SKIPTESTS=YES
shift
;;
-d=*|--build-dir=*) # Specify the directory to use for the build
BUILDDIR="${i#*=}"
shift
;;
-skipinstall|--skip-install) # Skip dpkg install
SKIPINSTALL=YES
;;
*)
#TODO Maybe define a help section?
;;
esac
done
if [[ $BUILDDIR && -d $BUILDDIR ]]; then
:
else
BUILDDIR="/tmp/source-git"
rm -rf "${BUILDDIR}" # Clear out all previous attempts
mkdir -p "${BUILDDIR}"
fi
echo "BUILD DIRECTORY USED: ${BUILDDIR}"
cd "${BUILDDIR}"
# Get the dependencies for git, then get openssl
sudo apt-get install build-essential fakeroot dpkg-dev -y
sudo apt-get build-dep git -y
sudo apt-get install libcurl4-openssl-dev -y
if ! grep -q "git-core" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
sudo apt-add-repository ppa:git-core/ppa --yes
else
echo "git-core already in ppa"
fi
apt-get source git
# We need to actually go into the git source directory
# find -type f -name "*.dsc" -exec dpkg-source -x \{\} \;
cd $(find -mindepth 1 -maxdepth 1 -type d -name "git-*")
pwd
# This is where we actually change the library from one type to the other.
sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control
# Compile time, itself, is long. Skips the tests. Do so at your own peril.
#sed -i -- '/TEST\s*=\s*test/d' ./debian/rules
if [[ $SKIPTESTS == "YES" ]]
then
sed -i -- '/TEST\s*=\s*test/d' ./debian/rules
fi
# Build it.
dpkg-buildpackage -rfakeroot -b
# Install
if [[ -z $SKIPINSTALL ]]
then
find .. -type f -name "git_*ubuntu*.deb" -exec sudo dpkg -i \{\} \;
fi