osc-vnc 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/osc/vnc/session.rb +1 -0
- data/lib/osc/vnc/version.rb +1 -1
- data/osc-vnc.gemspec +1 -1
- data/templates/conn/awesim.mustache +1 -1
- data/templates/conn/awesim_vnc.mustache +1 -0
- data/templates/conn/osc.mustache +1 -1
- data/templates/conn/osc_vnc.mustache +1 -0
- data/templates/script/_bash_helpers.mustache +25 -0
- data/templates/script/server.mustache +14 -4
- data/templates/script/vnc.mustache +3 -3
- metadata +11 -3
- data/templates/script/_port_helpers.mustache +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96f77f60bce20b1df652cbbfd9f8bff6233dfebf
|
4
|
+
data.tar.gz: f57bacfcd76f7e0a7fefac145d925ed965064cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e201792b877662d8f37eb67fccd51445d88508d33cbfb31c1a9d6e29e3cda929005596589615e5cb3ee633bbb0ba3f60f52c16990f0c5419073918c1237b8ecd
|
7
|
+
data.tar.gz: 73352f9e221c68d52e4fb143c5fecf9016e9e410a75e17d56cdaf7e4779157390b0ce7e7a63e712bf5b9b82b0d0ffbff4571c9695f42b398ef45b6fd82d25761
|
data/lib/osc/vnc/session.rb
CHANGED
@@ -61,6 +61,7 @@ module OSC
|
|
61
61
|
PBS::ATTR[:o] => "#{script.outdir}/$PBS_JOBID.output",
|
62
62
|
PBS::ATTR[:j] => "oe",
|
63
63
|
PBS::ATTR[:S] => "/bin/bash",
|
64
|
+
PBS::ATTR[:init_work_dir] => script.outdir
|
64
65
|
}.merge headers
|
65
66
|
h[PBS::ATTR[:N]] = "#{ENV['APP_TOKEN']}/#{h[PBS::ATTR[:N]]}" if ENV['APP_TOKEN']
|
66
67
|
|
data/lib/osc/vnc/version.rb
CHANGED
data/osc-vnc.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_runtime_dependency "pbs", "~> 2.0"
|
22
|
+
spec.add_runtime_dependency "pbs", "~> 2.0", ">= 2.0.3"
|
23
23
|
spec.add_runtime_dependency "mustache", "~> 1.0"
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -1 +1 @@
|
|
1
|
-
awesim://{{
|
1
|
+
awesim://{{host}}:{{port}}
|
@@ -0,0 +1 @@
|
|
1
|
+
awesim://{{#password}}:{{password}}@{{/password}}{{host}}:{{port}}
|
data/templates/conn/osc.mustache
CHANGED
@@ -1 +1 @@
|
|
1
|
-
osc://{{
|
1
|
+
osc://{{host}}:{{port}}
|
@@ -0,0 +1 @@
|
|
1
|
+
osc://{{#password}}:{{password}}@{{/password}}{{host}}:{{port}}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Generate random integer in range [$1..$2]
|
2
|
+
function random () {
|
3
|
+
shuf -i ${1}-${2} -n 1
|
4
|
+
}
|
5
|
+
|
6
|
+
# Check if port $1 is in use
|
7
|
+
function used_port () {
|
8
|
+
local PORT=${1}
|
9
|
+
nc -z localhost ${PORT} &>/dev/null
|
10
|
+
}
|
11
|
+
|
12
|
+
# Find available port in range [$1..$2]
|
13
|
+
# Default: [2000..65535]
|
14
|
+
function find_port () {
|
15
|
+
local PORT=$(random ${1:-2000} ${2:-65535})
|
16
|
+
while $(used_port ${PORT}); do
|
17
|
+
PORT=$(random ${1:-2000} ${2:-65535})
|
18
|
+
done
|
19
|
+
echo ${PORT}
|
20
|
+
}
|
21
|
+
|
22
|
+
# Generate random alphanumeric password with $1 (default: 32) characters
|
23
|
+
function create_passwd () {
|
24
|
+
tr -cd '[:alnum:]' < /dev/urandom 2>/dev/null | head -c${1:-32}
|
25
|
+
}
|
@@ -2,15 +2,15 @@
|
|
2
2
|
{{> _setup_env}}
|
3
3
|
|
4
4
|
{{#xinit}}
|
5
|
-
#
|
6
|
-
{{>
|
5
|
+
# Bash helper functions
|
6
|
+
{{> _bash_helpers}}
|
7
7
|
|
8
8
|
# Run developer supplied xinit script
|
9
9
|
source {{xinit}}
|
10
10
|
{{/xinit}}
|
11
11
|
|
12
12
|
# Function that creates a connection information file
|
13
|
-
function
|
13
|
+
function create_yml {
|
14
14
|
echo "Host: ${HOST}" > ${VNC_OUTFILE}
|
15
15
|
echo "Port: ${HOST_PORT}" >> ${VNC_OUTFILE}
|
16
16
|
echo "Password: ${PASSWORD}" >> ${VNC_OUTFILE}
|
@@ -34,13 +34,23 @@ SCRIPT_PID=$(pgrep -s 0 -f {{xstartup}})
|
|
34
34
|
|
35
35
|
{{> _ssh_tunnel}}
|
36
36
|
|
37
|
+
{{#after}}
|
38
|
+
# Run developer supplied after script
|
39
|
+
source {{after}}
|
40
|
+
{{/after}}
|
41
|
+
|
37
42
|
# Create the connection file
|
38
|
-
|
43
|
+
create_yml
|
39
44
|
|
40
45
|
{{> _tcp_server}}
|
41
46
|
|
42
47
|
# Wait for main process to finish
|
43
48
|
while [ -e /proc/${SCRIPT_PID} ]; do sleep 0.1; done
|
44
49
|
|
50
|
+
{{#clean}}
|
51
|
+
# Run developer supplied clean script
|
52
|
+
source {{clean}}
|
53
|
+
{{/clean}}
|
54
|
+
|
45
55
|
# Exit cleanly
|
46
56
|
exit 0
|
@@ -55,11 +55,11 @@ SCRIPT_PID=$(pgrep -s 0 -f {{xstartup}})
|
|
55
55
|
{{> _ssh_tunnel}}
|
56
56
|
|
57
57
|
{{#novnc?}}
|
58
|
-
#
|
59
|
-
{{>
|
58
|
+
# Bash helper functions
|
59
|
+
{{> _bash_helpers}}
|
60
60
|
|
61
61
|
# Launch noVNC on available port
|
62
|
-
export WEB_PORT=$(
|
62
|
+
export WEB_PORT=$(find_port)
|
63
63
|
{{{novnc_launcher}}} --vnc localhost:${HOST_PORT} --listen ${WEB_PORT} >> ${VNC_LOGFILE} 2>&1 &
|
64
64
|
{{/novnc?}}
|
65
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osc-vnc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Nicklas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pbs
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.3
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '2.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.3
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: mustache
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,15 +112,17 @@ files:
|
|
106
112
|
- lib/osc/vnc/version.rb
|
107
113
|
- osc-vnc.gemspec
|
108
114
|
- templates/conn/awesim.mustache
|
115
|
+
- templates/conn/awesim_vnc.mustache
|
109
116
|
- templates/conn/jnlp.mustache
|
110
117
|
- templates/conn/novnc.mustache
|
111
118
|
- templates/conn/osc.mustache
|
119
|
+
- templates/conn/osc_vnc.mustache
|
112
120
|
- templates/conn/osxvnc.mustache
|
113
121
|
- templates/conn/terminal.mustache
|
114
122
|
- templates/conn/txt.mustache
|
115
123
|
- templates/conn/vnc.mustache
|
116
124
|
- templates/conn/yaml.mustache
|
117
|
-
- templates/script/
|
125
|
+
- templates/script/_bash_helpers.mustache
|
118
126
|
- templates/script/_setup_env.mustache
|
119
127
|
- templates/script/_ssh_tunnel.mustache
|
120
128
|
- templates/script/_start_vncserver.mustache
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# Generate random integer in range [$1..$2)
|
2
|
-
function random () {
|
3
|
-
local MIN=$1
|
4
|
-
local MAX=$2
|
5
|
-
local RANGE=$((MAX - MIN))
|
6
|
-
local RAND=$(od -An -N4 -t uL /dev/urandom | tr -d " ")
|
7
|
-
local RAND_MAX=$((2**(4*8)))
|
8
|
-
|
9
|
-
local FLOAT=$(echo "$RANGE * ($RAND / $RAND_MAX) + $MIN" | bc -l)
|
10
|
-
|
11
|
-
echo $(echo "$FLOAT / 1" | bc)
|
12
|
-
}
|
13
|
-
|
14
|
-
# Check if port is used
|
15
|
-
function used_ports () {
|
16
|
-
local PORT=$1
|
17
|
-
|
18
|
-
echo $(netstat -lnt | awk -v port=$PORT '$6 == "LISTEN" && $4 ~ ":"port"$"' | wc -l)
|
19
|
-
}
|
20
|
-
|
21
|
-
# Get available port
|
22
|
-
function get_port () {
|
23
|
-
local PORT=$(random 2000 65535)
|
24
|
-
while [[ $(used_ports ${PORT}) -ne 0 ]]; do
|
25
|
-
PORT=$(random 2000 65535)
|
26
|
-
done
|
27
|
-
echo ${PORT}
|
28
|
-
}
|