forked from xxh/xxh-plugin-prerun-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·37 lines (29 loc) · 791 Bytes
/
build.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
#!/usr/bin/env bash
CDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
build_dir=$CDIR/build
while getopts A:K:q option
do
case "${option}"
in
q) QUIET=1;;
A) ARCH=${OPTARG};;
K) KERNEL=${OPTARG};;
esac
done
cd $CDIR
rm -rf $build_dir && mkdir -p $build_dir
for f in *prerun.sh home
do
cp -R $CDIR/$f $build_dir/
done
if [ -x "$(command -v pip)" ]; then
PYTHONUSERBASE=$build_dir/home/.local pip install --user -I -r pip-requirements.txt
# Fix python shebang
pypath=`readlink -f $(which python)`
if [ -d "$build_dir/home/.local/bin" ]; then
echo 'Fix PyPi packages shebang'
sed -i '1s|#!'$pypath'|#!/usr/bin/env python|' $build_dir/home/.local/bin/*
fi
else
echo 'Skip pip packages installation: pip not found.'
fi