Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
updater
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
updater
Commits
8b587af5
Commit
8b587af5
authored
Apr 06, 2019
by
Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parent
5d0a49f7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
.gitignore
.gitignore
+2
-0
config.default
config.default
+9
-0
update
update
+36
-0
No files found.
.gitignore
0 → 100644
View file @
8b587af5
config
\ No newline at end of file
config.default
0 → 100644
View file @
8b587af5
#token for your site
TOKEN=""
#Path to file. Should be accessible through the web and included to <head> of site pages
CODE_PATH="${HOME}/code.js"
#Generate gzipped version for nginx_gzip module (strongly recommended if module is enabled)
GZIP_CODE=true
\ No newline at end of file
update
0 → 100644
View file @
8b587af5
#!/usr/bin/env bash
function
error_exit
{
echo
"
$1
"
>
&2
exit
"
${
2
:-
1
}
"
}
[[
-e
"config"
]]
||
error_exit
"Config not found: please copy config.default to config (no extension)"
.
config
ARGON_ENDPOINT
=
"http://emd.instraroam.net/token/
${
TOKEN
}
"
SCRIPT_HEADER
=
'// HEADER'
CODE_DIR
=
$(
dirname
"
${
CODE_PATH
}
"
)
VERSION_REGEXP
=
"(?<=/
\*
)[0-9a-f_-]+(?=
\*
/)"
[[
!
-z
"
$TOKEN
"
]]
||
error_exit
"Config error: TOKEN is empty"
[[
!
-z
"
$CODE_PATH
"
]]
||
error_exit
"Config error: CODE_PATH is empty"
[[
-d
"
$CODE_DIR
"
]]
||
error_exit
"Path
${
CODE_DIR
}
is not a directory"
[[
-e
"
$CODE_PATH
"
]]
||
>
${
CODE_PATH
}
[[
-w
"
$CODE_PATH
"
]]
||
error_exit
"File
${
CODE_PATH
}
is not writable"
CODE
=
$(
curl
-s
-L
"
${
ARGON_ENDPOINT
}
"
)
R_VERSION
=
$(
grep
-oP
${
VERSION_REGEXP
}
<<<
${
CODE
})
[[
!
-z
"
$R_VERSION
"
]]
||
error_exit
"Version extracting error. Incorrect TOKEN"
L_VERSION
=
$(
grep
-oP
${
VERSION_REGEXP
}
${
CODE_PATH
})
if
[[
${
R_VERSION
}
!=
${
L_VERSION
}
]]
;
then
[[
-z
"
$SCRIPT_HEADER
"
]]
||
CODE
=
"
${
SCRIPT_HEADER
}
\n
${
CODE
}
"
echo
-e
${
CODE
}
>
${
CODE_PATH
}
[
"
$GZIP_CODE
"
!=
true
]
||
gzip
-q
-f
-9
-k
${
CODE_PATH
}
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment