-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack.sh
executable file
·71 lines (63 loc) · 1.53 KB
/
pack.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
#!/bin/bash
Usage() {
echo "Usage: $0 --outfile <outfile> [--install-dir <install-dir>] [--help]"
echo "args can be one or more of the following :"
echo " --outfile | -o : Output tarfile. Default: homecli.run"
echo " --install-dir : Installation directory. Default: $HOME/.homecli"
echo " --help | -h : Show this help message"
exit 1
}
set -e
while true; do
case "$1" in
--outfile | -o)
OUTFILE=$2
shift 2
;;
--install-dir)
INSTALL_DIR=$2
shift 2
;;
--help | -h)
Usage
;;
-*)
echo "Unknown option: $1"
Usage
;;
*)
break
;;
esac
done
# INSTALL_DIR: Installation directory. Default: $HOME/.homecli
if [ -z "$INSTALL_DIR" ]; then
INSTALL_DIR=${HOMECLI_INSTALL_DIR:-$HOME/.homecli}
fi
if [ -z "$OUTFILE" ]; then
OUTFILE=${1:-homecli.run}
fi
# shift if $1 is set
if [ -n "$1" ]; then
shift
fi
rm -f $INSTALL_DIR/miniconda.tar.gz
$INSTALL_DIR/uv/tool/conda-pack/bin/conda-pack -p $INSTALL_DIR/miniconda -o $INSTALL_DIR/miniconda.tar.gz
CURDIR=$(pwd)
echo $CURDIR
cd $INSTALL_DIR
rm -rf $INSTALL_DIR/packed
mkdir $INSTALL_DIR/packed
tar --exclude="__pycache__" -cvf $INSTALL_DIR/packed/homecli.tar.gz \
HOME bin miniconda.tar.gz uv nvim
rm miniconda.tar.gz
cp $INSTALL_DIR/HOME/scripts/install.sh \
$INSTALL_DIR/HOME/scripts/uninstall.sh \
$INSTALL_DIR/HOME/scripts/_unpack.sh \
$INSTALL_DIR/packed
# if OUTFILE is a relative path, make it absolute
if [[ ! "$OUTFILE" = /* ]]; then
OUTFILE=$CURDIR/$OUTFILE
fi
./HOME/scripts/makeself/makeself.sh ./packed $OUTFILE "HOME Installer" ./_unpack.sh
cd -