CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
#!/bin/sh
2
###########################################################################
3
##
4
#W gapd.sh The SCSCP package Alexander Konovalov
5
#W Steve Linton
6
##
7
## gapscscp.sh [-h host] [-a] [-l] [-u] [-p port] [-t]
8
##
9
## The following options may be used to overwrite the default method to
10
## specify the hostname to run GAP SCSCP server, stated in scscp/config.g :
11
##
12
## 1) if '-h host' is specified, then the server will be started at 'host'.
13
## 'host' may be given as machine name with or without domain or even as
14
## 'localhost', though we have -l option for that purpose
15
##
16
## 2) if '-a' is specified, then the output of the call to 'hostname' will
17
## be used as the SCSCP server address
18
##
19
## 3) if '-l' is specified, then the server will be started at localhost
20
## and will not accept any incoming connections from the outside
21
##
22
## 4) if '-u' is specified, the server will be started in a "universal"
23
## mode and will accept all incoming connections
24
##
25
## The options 1-4 above are incompatible, so in case several of them will
26
## be given, only the option with the biggest number will be used
27
##
28
## If none of the options 1-4 above is stated, the hostname for the server
29
## will be taken from the scscp/config.g file
30
##
31
## Additionally, you may use the following options:
32
##
33
## 5) if '-p port' is specified, this will overwrite the default port for
34
## the SCSCP server given in scscp/config.g
35
##
36
## 6) if '-t' is specified than the output will be redirected to a
37
## temporary file, which name will be displayed on screen during
38
## startup. Otherwise, by default it will be redirected to /dev/null
39
##
40
##
41
###########################################################################
42
##
43
## PART 1. MODIFY PATHS IF NEEDED
44
##
45
###########################################################################
46
##
47
## Define the local call of GAP and call options, if necessary, for
48
## example, memory usage, start with the workspace etc. The path may be
49
## relative (to start from this directory) or absolute.
50
##
51
GAP="../../bin/gap.sh -b -r"
52
##
53
###########################################################################
54
##
55
## Define the configuration file for the SCSCP server. Note that since GAP
56
## reads the configuration file immediately before starting SCSCP server,
57
## you may redefine in it all variables that were set to their default
58
## values in scscp/config.g and scscp/configpar.g files (explicitly or
59
## reading your appropriately modified private copies of that files).
60
## The path may be relative (to start from this directory) or absolute.
61
##
62
SCSCP_CONFIG="example/myserver.g"
63
##
64
##
65
###########################################################################
66
67
###########################################################################
68
##
69
## PART 2. YOU NEED NOT TO MODIFY ANYTHING BELOW
70
##
71
###########################################################################
72
##
73
## Parse the arguments.
74
##
75
autohost="no"
76
localhost="no"
77
unimode="no"
78
use_temp_file="no"
79
host=";"
80
port=";"
81
82
option="yes"
83
while [ $option = "yes" ]; do
84
option="no"
85
case $1 in
86
87
-a) shift; option="yes"; autohost="yes";;
88
89
-h) shift; option="yes"; host=":=\""$1"\";"; shift;;
90
91
-l) shift; option="yes"; localhost="yes";;
92
93
-u) shift; option="yes"; unimode="yes";;
94
95
-p) shift; option="yes"; port=":="$1";"; shift;;
96
97
-t) shift; option="yes"; use_temp_file="yes";;
98
99
esac
100
done
101
102
if [ $use_temp_file = "yes" ]; then
103
OUTFILE=`mktemp /tmp/gapscscp.XXXXXX`
104
else
105
OUTFILE="/dev/null"
106
fi;
107
108
if [ $autohost = "yes" ]; then
109
host=":=Hostname();"
110
fi;
111
112
if [ $localhost = "yes" ]; then
113
host=":=false;"
114
fi;
115
116
if [ $unimode = "yes" ]; then
117
host=":=true;"
118
fi;
119
120
echo "Starting SCSCP server with output to $OUTFILE"
121
122
# The next line starts GAP SCSCP server.
123
# To redirect stderr to /dev/null as well,
124
# replace $OUTFILE 2>&1 & with $OUTFILE &
125
126
echo 'LoadPackage("scscp");SetInfoLevel(InfoSCSCP,0);SCSCPserverAddress'$host'SCSCPserverPort'$port'Read("'$SCSCP_CONFIG'"); if SCSCPserverStatus=fail then QUIT_GAP(); fi;' | exec $GAP > $OUTFILE &
127
128
###########################################################################
129
##
130
#E
131
##
132
133