mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Add --group parameter.
This commit is contained in:
parent
0a24d0924a
commit
c8cb8f788a
2 changed files with 17 additions and 4 deletions
|
@ -5,3 +5,5 @@ To use, call this script with the directory where your ebooks go as its last arg
|
|||
# deploy-ebook-to-www
|
||||
|
||||
To use, call this script with the directories of the books you want to deploy as its arguments. For example, to deploy all ebooks after using sync-ebooks, run `deploy-ebook-to-www /standardebooks.org/ebooks/*`. To deploy only The Time Machine by H.G Wells, you would run `deploy-ebook-to-www /standardebooks.org/ebooks/h-g-wells_the-time-machine`. Note that deploy-ebook-to-www assumes that your webroot is in /standardebooks.org/. To output progress information, use -v or --verbose.
|
||||
|
||||
The default group is se. to use a different one, specify it with the --group option. For instance, to use this script inside the included Vagrant VM, which uses the www-data group, use `deploy-ebook-to-www --group www-data /path/to/ebook`.
|
||||
|
|
|
@ -6,8 +6,9 @@ DESCRIPTION
|
|||
Deploy a Standard Ebook source repository to the web.
|
||||
|
||||
USAGE
|
||||
deploy-ebook-to-www [-v,--verbose] DIRECTORY [DIRECTORY...]
|
||||
deploy-ebook-to-www [-v,--verbose] [-g,--group GROUP] DIRECTORY [DIRECTORY...]
|
||||
DIRECTORY is a bare source repository.
|
||||
GROUP is a groupname. Defaults to "se".
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
@ -16,6 +17,7 @@ require(){ command -v "$1" > /dev/null 2>&1 || { suggestion=""; if [ -n "$2" ];
|
|||
# End boilerplate
|
||||
|
||||
verbose="false"
|
||||
group="se"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
|
@ -29,10 +31,19 @@ while [ $# -gt 0 ]; do
|
|||
verbose="true"
|
||||
shift 1
|
||||
;;
|
||||
-g|--group)
|
||||
[ -n "$2" ] || die "Group cannot be empty."
|
||||
group="$2"
|
||||
shift 2
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ "$(getent group "${group}")" ]; then
|
||||
die "Group ${group} does not exist. Either use --group or create the group."
|
||||
fi
|
||||
|
||||
# Check for dependencies
|
||||
require "convert" "Try: apt-get install imagemagick"
|
||||
require "rsvg-convert" "Try: apt-get install librsvg2-bin"
|
||||
|
@ -127,7 +138,7 @@ do
|
|||
mv "${imgWorkDir}/${urlSafeIdentifier}@2x.jpg" "${imgWorkDir}/${urlSafeIdentifier}-cover@2x.jpg"
|
||||
mv "${imgWorkDir}/${urlSafeIdentifier}.jpg" "${imgWorkDir}/${urlSafeIdentifier}-cover.jpg"
|
||||
|
||||
sudo chgrp --preserve-root --recursive se "${imgWorkDir}/${urlSafeIdentifier}"*
|
||||
sudo chgrp --preserve-root --recursive "${group}" "${imgWorkDir}/${urlSafeIdentifier}"*
|
||||
sudo chmod --preserve-root --recursive g+w "${imgWorkDir}/${urlSafeIdentifier}"*
|
||||
|
||||
if [ "${verbose}" = "true" ]; then
|
||||
|
@ -164,10 +175,10 @@ do
|
|||
# Delete the now-empty work dir (empty except for .git)
|
||||
rm --preserve-root --recursive --force "${workDir}" "${imgWorkDir}"
|
||||
|
||||
sudo chgrp --preserve-root --recursive se "${webDir}"
|
||||
sudo chgrp --preserve-root --recursive "${group}" "${webDir}"
|
||||
sudo chmod --preserve-root --recursive g+ws "${webDir}"
|
||||
|
||||
sudo chgrp --preserve-root --recursive se "/standardebooks.org/www/images/covers/"
|
||||
sudo chgrp --preserve-root --recursive "${group}" "/standardebooks.org/www/images/covers/"
|
||||
sudo chmod --preserve-root --recursive g+ws "/standardebooks.org/www/images/covers/"
|
||||
|
||||
if [ "${verbose}" = "true" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue