generated from hyperk/hk-LibToolPackTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Import.sh
executable file
·71 lines (64 loc) · 1.5 KB
/
Import.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
#!/bin/bash
if ! command -v dialog &> /dev/null
then
if [ "$1" == "" ]
then
echo -e "Usage: ./Import <\"Toolname\" or \"All\">"
elif [ "$1" == "All" ]
then
for Tool in `ls -d */|sed s:/:: | grep -v docs | grep -v template`
do
ln -s `pwd`/$Tool ../../InactiveTools/$Tool
if [ -f `pwd`/$Tool/Import.sh ]; then
echo "Calling Tool $Tool import script..."
`pwd`/$Tool/Import.sh
if [ $? -ne 0 ]; then
echo "Error occurred calling `pwd`/${Tool}Import.sh!"
fi
fi
done
else
test=0
for Tool in `ls -d */ | grep -v docs | grep -v template`
do
if [ "$1/" == "$Tool" ]
then
ln -s `pwd`/$1 ../../InactiveTools/$1
if [ -f `pwd`/$Tool/Import.sh ]; then
echo "Calling Tool $Tool import script..."
`pwd`/$Tool/Import.sh
if [ $? -ne 0 ]; then
echo "Error occurred calling `pwd`/${Tool}Import.sh!"
fi
fi
fi
done
fi
else
num=0
dialog --checklist "Select Tools to import with <spacebar>, Enter for OK and ESC for Cancel:" 0 0 0 \
`for Tool in \`ls -d */|sed s:/:: | grep -v docs | grep -v template\`
do
echo "$Tool $num off "
num=$(expr 1 + $num)
done` 2> tmptools
if [ $? -eq 0 ]
then
clear
for Tool in `cat tmptools`
do
ln -s `pwd`/$Tool ../../InactiveTools/$Tool
if [ -f `pwd`/$Tool/Import.sh ]; then
echo "Calling Tool $Tool import script..."
`pwd`/$Tool/Import.sh
if [ $? -ne 0 ]; then
echo "Error occurred calling `pwd`/$Tool/Import.sh!"
fi
fi
echo -e "\e[38;5;226m$Tool Imported \e[0m"
done
rm tmptools
else
clear
fi
fi