Skip to content

Commit

Permalink
Support for new cpgh (greyhole --cp) command
Browse files Browse the repository at this point in the history
  • Loading branch information
gboudreau committed Sep 5, 2021
1 parent 727191c commit 526b7bf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ RUN curl -Lo greyhole-master.zip https://github.com/gboudreau/Greyhole/archive/$
mkdir -p /var/spool/greyhole && \
chmod 777 /var/spool/greyhole && \
mkdir -p /usr/share/greyhole && \
install -m 0755 -D -p greyhole /usr/share/greyhole/greyhole && \
install -m 0755 -D -p greyhole-dfree /usr/bin && \
install -m 0755 -D -p greyhole-php /usr/bin && \
install -m 0755 -D -p greyhole /usr/share/greyhole && \
install -m 0755 -D -p greyhole-dfree /usr/share/greyhole && \
install -m 0755 -D -p greyhole-php /usr/share/greyhole && \
install -m 0755 -D -p greyhole-dfree.php /usr/share/greyhole && \
install -m 0644 -D -p greyhole.cron.d /etc/cron.d/greyhole && \
install -m 0755 -D -p greyhole.cron.weekly /etc/cron.weekly/greyhole && \
Expand Down Expand Up @@ -59,6 +59,9 @@ RUN curl -Lo greyhole-master.zip https://github.com/gboudreau/Greyhole/archive/$
mv samba-module /usr/share/greyhole/ && \
ln -s /config-greyhole/greyhole.conf /etc/greyhole.conf && \
ln -s /usr/share/greyhole/greyhole /usr/bin/greyhole && \
ln -s /usr/share/greyhole/greyhole-dfree /usr/bin/greyhole-dfree && \
ln -s /usr/share/greyhole/greyhole-php /usr/bin/greyhole-php && \
ln -s /usr/share/greyhole/greyhole /usr/bin/cpgh && \
echo "include_path=.:/usr/share/php8:/usr/share/greyhole" > /etc/php8/conf.d/02_greyhole.ini

# Re-use pre-compiled .so or build a new one
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You will need to edit your `greyhole.conf` to point to your host's IP address, i
If you'd like to be able to view/grep the Greyhole log files, make sure you put them in a folder that is mounted from your host.
Ref: `greyhole_log_file` & `greyhole_error_log_file` in your `greyhole.conf`)

Symlink `helpers/greyhole.sh` as `/usr/local/bin/greyhole` on your host, to be able to execute any `greyhole ...` command on you host (`greyhole --fsck...`, `greyhole --stats`, `greyhole --logs`, etc.)
Symlink `helpers/greyhole.sh` as `/usr/local/bin/greyhole` on your host, to be able to execute any `greyhole ...` command on you host (`greyhole --fsck ...`, `greyhole --stats`, `greyhole --logs`, etc.)

`helpers/restart-greyhole.sh` and `helpers/restart-samba.sh` can be used to restart the Greyhole and Samba daemons, within a running container, without having to restart the container itself.

Expand All @@ -30,6 +30,7 @@ git clone https://github.com/gboudreau/samba-greyhole-docker.git "$TARGET_PATH"
# Change WorkingDirectory in helpers/samba-greyhole.service; also change the folders & files mounted using -v
mkdir -p /usr/share/greyhole/
ln -s "$TARGET_PATH/helpers/greyhole.sh" /usr/local/bin/greyhole
ln -s "$TARGET_PATH/helpers/greyhole-cp.sh" /usr/local/bin/cpgh
ln -s "$TARGET_PATH/helpers/samba-greyhole.service" /etc/systemd/system/samba-greyhole.service
systemctl enable samba-greyhole
```
Expand Down
13 changes: 13 additions & 0 deletions helpers/greyhole-cp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

opts=""
if tty -s; then
opts="-it"
fi

first_char=${1:0:1}
if [ "$first_char" != "/" ]; then
sudo docker exec $opts -e "IN_DOCKER=1" samba-greyhole /usr/bin/cpgh "$(pwd)/$@"
else
sudo docker exec $opts -e "IN_DOCKER=1" samba-greyhole /usr/bin/cpgh "$@"
fi

0 comments on commit 526b7bf

Please sign in to comment.