Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
3d70b84f
Commit
3d70b84f
authored
Oct 26, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add azbyka_update_fallback.sh (eterbug #11957)
parent
06690621
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
azbyka_update_fallback.sh
web/azbyka_update_fallback.sh
+51
-0
No files found.
web/azbyka_update_fallback.sh
0 → 100755
View file @
3d70b84f
#!/bin/sh
TEMPL
=
/etc/nginx/include/static-fallback.conf.TEMPLATE
TARG
=
/etc/nginx/include/static-fallback-
fatal
()
{
echo
"Fatal:
$@
"
exit
1
}
# new file -> old file
rewrite_if_changed
()
{
local
NEWFILE
=
"
$1
"
OLDFILE
=
"
$2
"
if
[
-r
$OLDFILE
]
;
then
if
diff
-u
$OLDFILE
$NEWFILE
;
then
echo
"
$OLDFILE
is not changed"
rm
-f
$NEWFILE
else
mv
-f
$NEWFILE
$OLDFILE
fi
else
mv
-f
$NEWFILE
$OLDFILE
fi
}
gen_static_fallback
()
{
local
f
=
"
$1
"
local
of
=
$TARG$f
.conf
local
otf
=
$TARG$f
.conf.tmp
echo
echo
"generate
$otf
"
cat
$TEMPL
|
sed
-e
"s|@fallback|@fallback-
$f
|g"
>
$otf
# TODO: merge with rewrite_if_changed
[
-r
"
$of
"
]
||
{
echo
"there is no target
$of
file"
;
return
1
;
}
[
-s
"
$otf
"
]
||
{
echo
"empty generated file
$otf
"
;
return
1
;
}
rewrite_if_changed
"
$otf
"
"
$of
"
}
if
[
-n
"
$1
"
]
;
then
gen_static_fallback
"
${
1
/-manual/
}
"
exit
fi
grep
"include/static-fallback-.*
\.
conf"
/etc/nginx/sites-enabled.d/azbyka.d/
*
.conf |
sed
-e
"s|:.*||g"
| xargs
-n1
-I
"{}"
basename
"{}"
.conf |
sort
-u
|
while
read
f
;
do
gen_static_fallback
"
${
f
/-manual/
}
"
#exit
done
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