Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hifis.net
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
HIFIS
Overall
hifis.net
Commits
5eaeaaf7
Verified
Commit
5eaeaaf7
authored
4 years ago
by
Erxleben, Fredo
Browse files
Options
Downloads
Patches
Plain Diff
Add script to copy favicons
parent
f19ca7f2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/copy_favicons.bash
+82
-0
82 additions, 0 deletions
scripts/copy_favicons.bash
with
82 additions
and
0 deletions
scripts/copy_favicons.bash
0 → 100644
+
82
−
0
View file @
5eaeaaf7
#!/usr/bin/env bash
# ==============================================================================
# title : copy_favicons.bash
# description : This script copies favicons from the subfolder "_favicons"
# into the jekyll project root folder.
# The checks are there to make sure that the parameters given
# to this script are correct.
# date : 2019-11-07
# usage : $ bash ./scripts/copy_favicons.bash "_favicons/" "public/" "/"
# parameters : First parameter $1 is the source folder name which contains the
# favicons,
# second parameter $2 is the target folder name into which the
# favicons are copied,
# third parameter $3 is the subpath in target folder which
# is usually just a slash.
# notes : The intention to outsource this script is to collect all shell
# scripts in a separate scripts folder instead of putting all
# scripts with all its length into the GitLab CI pipeline
# configuration yaml file.
# Beside that users can manually call this script as well.
# ==============================================================================
set
-e
# Give usage message if number of parameters is not zero or three.
if
[[
"$#"
-ne
0
]]
&&
[[
"$#"
-ne
3
]]
then
echo
"copy_favicons.bash:"
echo
"The wrong number of parameters are given."
echo
"Usage: Call script with zero or three parameters:"
echo
"e.g.
\$
bash ./scripts/copy_favicons.bash "
\
"
\"
_favicons/
\"
\"
public/
\"
\"
/
\"
"
exit
1
fi
# Regex to match folder names with trailing slash.
patternFolderNameWithSlash
=
"^+
\/
$"
# Checks that variable is set, folder exists and folder name ends with "/".
FAVICONS_SOURCE_DIR
=
"_favicons/"
if
[[
-n
"
${
1
}
"
]]
&&
[[
"
${
1
}
"
=
~
[
patternFolderNameWithSlash]
]]
&&
[[
-d
"
${
1
}
"
]]
then
FAVICONS_SOURCE_DIR
=
${
1
}
fi
# Checks that variable is set, folder exists and folder name ends with "/".
FAVICONS_TARGET_DIR
=
"public/"
if
[[
-n
"
${
2
}
"
]]
&&
[[
"
${
2
}
"
=
~
[
patternFolderNameWithSlash]
]]
&&
[[
-d
"
${
2
}
"
]]
then
FAVICONS_TARGET_DIR
=
${
2
}
fi
# Checks that variable is set, folder exists and sub-path ends with "/"
# but is not "/" itself which then defaults to "" (empty string) for proper
# string concatination later on.
# The parameter of a sub-path is needed for use in GitLab CI pipeline.
FAVICONS_PROJECT_SUBPATH
=
""
if
[[
-n
"
${
3
}
"
]]
&&
[[
"
${
3
}
"
=
~
[
patternFolderNameWithSlash]
]]
&&
[[
-d
"
${
3
}
"
]]
then
FAVICONS_PROJECT_SUBPATH
=
${
3
}
fi
# Copy files to target if source files are given.
if
[[
-d
${
FAVICONS_SOURCE_DIR
}
]]
then
cp
./
"
${
FAVICONS_SOURCE_DIR
}
"
*
\
./
"
${
FAVICONS_TARGET_DIR
}${
FAVICONS_PROJECT_SUBPATH
}
"
echo
"copy_favicons.bash:"
echo
"Copying favicons completed."
exit
0
else
echo
"copy_favicons.bash:"
echo
"Favicons folder is missing."
exit
1
fi
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