Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
8776f659
Commit
8776f659
authored
13 years ago
by
Alvaro Graves
Browse files
Options
Downloads
Patches
Plain Diff
Adding backup capability to lodspk.sh
parent
189cd752
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
utils/lodspk.sh
+29
-31
29 additions, 31 deletions
utils/lodspk.sh
utils/modules/backup.sh
+22
-0
22 additions, 0 deletions
utils/modules/backup.sh
views/uri.local:alvaro/html.template
+50
-0
50 additions, 0 deletions
views/uri.local:alvaro/html.template
with
101 additions
and
31 deletions
utils/lodspk.sh
+
29
−
31
View file @
8776f659
#!/bin/bash
#
# https://github.com/alangrafu/lodspeakr/blob/master/utils/ldspk.sh
USAGE
=
"Usage:
$0
create|delete uri|type|service foo [html|rdf|ttl|nt|json]"
USAGEDEBUG
=
"Usage:
$0
debug on|off"
if
[[
$#
-eq
0
||
"
$1
"
==
"--help"
]]
;
then
echo
$USAGE
exit
1
echo
$USAGE
exit
1
fi
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
operations
=(
create delete debug
)
modules
=(
type
service uri
)
formats
=(
html rdf ttl nt json all
)
debugOptions
=(
on off 0 1
)
operations
=(
create delete debug backup
)
currentOperation
=
currentModule
=
currentFormat
=
debugOperation
=
if
[[
${
operations
[@]
}
=
~
$1
]]
;
then
currentOperation
=
$1
...
...
@@ -27,17 +20,17 @@ else
exit
1
fi
if
[[
$currentOperation
=
"debug"
]]
then
if
[[
${
debugOptions
[@]
}
=
~
$2
]]
then
debugOperation
=
$2
els
e
echo
"Debug option not supported.
Operation
abor
te
d
"
>
&2
echo
$USAGEDEBUG
exit
1
fi
else
## Backup
if
[[
$currentOperation
==
"backup"
]]
;
then
$DIR
/modules/backup.sh
fi
## Create/delet
e
if
[[
$currentOperation
==
"create"
||
$current
Operation
==
"dele
te"
]]
;
then
modules
=(
type
service uri
)
formats
=(
html rdf ttl nt json all
)
currentModule
=
currentFormat
=
if
[[
${
modules
[@]
}
=
~
$2
]]
;
then
currentModule
=
$2
else
...
...
@@ -45,9 +38,9 @@ else
echo
$USAGE
exit
1
fi
currentUnit
=
$3
if
[[
${
formats
[@]
}
=
~
$4
]]
;
then
currentFormat
=
$4
else
...
...
@@ -59,15 +52,20 @@ else
exit
1
fi
fi
$DIR
/modules/create-
$currentModule
.sh
"
$currentUnit
"
"
$currentFormat
"
fi
if
[[
$currentOperation
==
"create"
]]
;
then
$DIR
/modules/create-
$currentModule
.sh
"
$currentUnit
"
"
$currentFormat
"
fi
if
[[
$currentOperation
==
"delete"
]]
;
then
$DIR
/modules/delete-
$currentModule
.sh
"
$currentUnit
"
"
$currentFormat
"
fi
## Debug
if
[[
$currentOperation
==
"debug"
]]
;
then
php
$DIR
/modules/debug.php
"
$debugOperation
"
debugOptions
=(
on off 0 1
)
debugOperation
=
if
[[
${
debugOptions
[@]
}
=
~
$2
]]
then
debugOperation
=
$2
else
echo
"Debug option not supported. Operation aborted"
>
&2
echo
$USAGEDEBUG
exit
1
fi
php
$DIR
/modules/debug.php
"
$debugOperation
"
fi
This diff is collapsed.
Click to expand it.
utils/modules/backup.sh
0 → 100755
+
22
−
0
View file @
8776f659
#!/bin/bash
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
BACKUPDIR
=
$HOME
/lodspeakr_backup
cd
$DIR
/../..
if
[[
!
-d
$BACKUPDIR
]]
;
then
echo
"WARNING: No
$BACKUPDIR
dir. Creating it."
>
&2
mkdir
$BACKUPDIR
fi
if
[[
!
-d
$BACKUPDIR
]]
;
then
echo
"ERROR: Couldn't create
$BACKUPDIR
. Operation aborted"
>
&2
exit
1
fi
tmpFile
=
lodspeakr_backup_
`
date
+%Y%m%d%H%M%S
`
.tar.gz
tar
-czf
$tmpFile
settings.inc.php models views
mv
$tmpFile
$BACKUPDIR
/
echo
"New backup
$tmpFile
created"
This diff is collapsed.
Click to expand it.
views/uri.local:alvaro/html.template
0 → 100644
+
50
−
0
View file @
8776f659
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
{%
for
i
,
ns
in
base.ns
%}
xmlns:
{{
i
}}="{{
ns
}}"
{%
endfor
%}
version=
"XHTML+RDFa 1.0"
xml:lang=
"en"
>
<head>
<title>
Page about {{lodspk.this.value}}
</title>
<link
href=
"{{lodspk.baseUrl}}css/basic.css"
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
/>
<link
rel=
"alternate"
type=
"application/rdf+xml"
title=
"RDF/XML Version"
href=
"{{lodspk.this.value}}.rdf"
/>
<link
rel=
"alternate"
type=
"text/turtle"
title=
"Turtle Version"
href=
"{{lodspk.this.value}}.ttl"
/>
<link
rel=
"alternate"
type=
"text/plain"
title=
"N-Triples Version"
href=
"{{lodspk.this.value}}.nt"
/>
<link
rel=
"alternate"
type=
"application/json"
title=
"RDFJSON Version"
href=
"{{lodspk.this.value}}.json"
/>
</head>
<body
about=
"{{lodspk.this.value}}"
>
<h1>
Page about
<a
href=
'{{lodspk.this.value}}'
>
{{lodspk.this.curie}}
</a></h1>
<div>
<h2>
Information from {{lodspk.this.curie}}
</h2>
<table>
{% for row in models.main %}
{% if row.s1%}
<tr>
<td><a
href=
'{{row.s1.value}}'
>
{{row.s1.curie}}
</a></td>
{% if row.p1.uri == 1 %}
<td><a
rel=
'{{row.s1.curie}}'
href=
'{{row.p1.value}}'
>
{{row.p1.curie}}
</a></td>
{% else %}
<td><span
property=
'{{row.s1.curie}}'
>
{{row.p1.value}}
</span></td>
{% endif %}
</tr>
{% endif %}
{% endfor %}
</table>
<br/><br/>
<h2>
Information pointing to {{lodspk.this.curie}}
</h2>
<table>
{% for row in models.main %}
{% if row.s2%}
<tr>
<td><a
href=
'{{row.s2.value}}'
>
{{row.s2.curie}}
</a></td>
<td><a
rev=
'[{{row.p2.curie}}]'
href=
'{{row.s2.value}}'
>
{{row.p2.curie}}
</a></td>
</tr>
{%endif %}
{% endfor %}
</table>
</div>
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment