-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·60 lines (53 loc) · 1.78 KB
/
install.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
#!/bin/bash
DESTDIR=$HOME/.icd
DESTFILE=$HOME/.bashrc
echo "==============================="
echo "| copying icd-file to ~/.icd/ |"
echo "==============================="
echo "[1] copy from here to ~/.icd/ (default)"
echo "[2] copy from here to ~/.local/bin"
echo "[3] copy to other location"
read input
if [[ $input = 2 ]]; then DESTDIR=$HOME/.local/bin; fi
if [[ $input = 3 ]]; then
echo -n "Please specify location: "
read DESTDIR
fi
PWD=$(pwd)
mkdir -vp $HOME/.icd
cp -v $PWD/icd $HOME/.icd/icd
f=-f
source icd
echo "=========================================="
echo "| Follow links while mapping filesystem? |"
echo "=========================================="
echo -e "[yes] follow links (default)\n[no] don't follow links"
read input
if [[ $input == "no" || $input == "n" ]]; then f=""; echo "not following symbolic links" ; fi
echo "saving map of home filesystem "
echo "this might take some time depending on your filesystem size..."
mapfile=$HOME/.icd/55_map
icd -m $f > $mapfile
echo "saved map of home filesytem to $mapfile"
echo ""
###count length of destdir
lod=$(echo -n $DESTDIR | wc -c )
head -c $lod /dev/zero | tr '\0' '='
echo "======================================"
echo "| sourcing $DESTDIR/icd from following file: |"
head -c $lod /dev/zero | tr '\0' '='
echo "======================================"
echo "[1] ~/.bashrc (default)"
echo "[2] ~/.bash_functions"
echo "[3] other file"
echo "[4] /dev/null (update)"
read input
if [[ $input = 2 ]]; then DESTFILE=$HOME/.bash_functions ; fi
if [[ $input = 3 ]]; then
echo -n "Please specify location: "
read INPUT
DESTFILE=$(echo $INPUT | sed "s|~|$HOME|")
fi
if [[ $input = 4 ]]; then DESTFILE=/dev/null ; fi
echo "following text was apended to $DESTFILE"
echo "if [ -f $HOME/.icd/icd ] ; then source $HOME/.icd/icd ; fi" | tee -a $DESTFILE