Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if skipgravityonboot set, check db version. #1402

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# If PIHOLE_UID is set, modify the pihole user's id to match
if [ -n "${PIHOLE_UID}" ]; then
currentId=$(id -u ${username})
currentId=$(id -u pihole)
if [[ ${currentId} -ne ${PIHOLE_UID} ]]; then
echo " [i] Changing ID for user: pihole (${currentId} => ${PIHOLE_UID})"
usermod -o -u ${PIHOLE_UID} pihole
Expand Down Expand Up @@ -104,16 +104,25 @@

/usr/sbin/crond

#migrate Database if needed:
gravityDBfile=$(getFTLConfigValue files.gravity)

if [ -z "$SKIPGRAVITYONBOOT" ] || [ ! -f "${gravityDBfile}" ]; then
if [ -n "$SKIPGRAVITYONBOOT" ];then
echo " SKIPGRAVITYONBOOT is set, however ${gravityDBfile} does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate."
echo " Ignoring SKIPGRAVITYONBOOT on this occaision."
fi
if [ -n "${SKIPGRAVITYONBOOT}" ]; then
if [ -f "${gravityDBfile}" ]; then
#skip set + file =>update if needed
echo " Skipping Gravity Database Update."
# TODO: Revist this path if we move to a multistage build

Check failure on line 113 in src/start.sh

View workflow job for this annotation

GitHub Actions / spell-check

Revist ==> Revisit
source /etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh
PromoFaux marked this conversation as resolved.
Show resolved Hide resolved
upgrade_gravityDB "${gravityDBfile}" "/etc/pihole"
else
#skip set + nofile => pihole -g (install error)
echo " SKIPGRAVITYONBOOT is set, however ${gravityDBfile} does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate."
echo " Ignoring SKIPGRAVITYONBOOT on this occasion."
pihole -g
fi
else
echo " Skipping Gravity Database Update."
#skip not set + no file => error => create file
#skip not set + file => update db + lists
pihole -g
fi

pihole updatechecker
Expand Down