Skip to content

Commit

Permalink
Merge pull request #27 from linuxserver/cp-noise
Browse files Browse the repository at this point in the history
Wrap cp in conditional to reduce noise
  • Loading branch information
nemchik authored Jun 14, 2023
2 parents 5ddf269 + 564ff09 commit 3ce38a5
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions root/etc/s6-overlay/s6-rc.d/init-xbackbone-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,57 @@ mkdir -p /config/www/xbackbone/resources/{cache,database,sessions}

# create symlinks
if [[ ! -L "/app/www/public/config.php" ]]; then
cp -nR "/app/www/public/config.php" "/config/www/xbackbone/config.php"
if [[ -f "/app/www/public/config.php" ]]; then
cp -nR "/app/www/public/config.php" "/config/www/xbackbone/config.php" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/config.php"
ln -s "/config/www/xbackbone/config.php" "/app/www/public/config.php"
fi

if [[ ! -L "/app/www/public/storage" ]]; then
cp -nR "/app/www/public/storage" "/config/www/xbackbone/storage"
if [[ -d "/app/www/public/storage" ]]; then
cp -nR "/app/www/public/storage" "/config/www/xbackbone/storage" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/storage"
ln -s "/config/www/xbackbone/storage" "/app/www/public/storage"
fi

if [[ ! -L "/app/www/public/logs" ]]; then
cp -nR "/app/www/public/logs" "/config/www/xbackbone/logs"
if [[ -d "/app/www/public/logs" ]]; then
cp -nR "/app/www/public/logs" "/config/www/xbackbone/logs" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/logs"
ln -s "/config/www/xbackbone/logs" "/app/www/public/logs"
fi

if [[ ! -L "/app/www/public/resources/cache" ]]; then
cp -nR "/app/www/public/resources/cache" "/config/www/xbackbone/resources/cache"
if [[ -d "/app/www/public/resources/cache" ]]; then
cp -nR "/app/www/public/resources/cache" "/config/www/xbackbone/resources/cache" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/resources/cache"
ln -s "/config/www/xbackbone/resources/cache" "/app/www/public/resources/cache"
fi

if [[ ! -L "/app/www/public/resources/database" ]]; then
cp -nR "/app/www/public/resources/database" "/config/www/xbackbone/resources/database"
if [[ -d "/app/www/public/resources/database" ]]; then
cp -nR "/app/www/public/resources/database" "/config/www/xbackbone/resources/database" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/resources/database"
ln -s "/config/www/xbackbone/resources/database" "/app/www/public/resources/database"
fi

if [[ ! -L "/app/www/public/resources/sessions" ]]; then
cp -nR "/app/www/public/resources/sessions" "/config/www/xbackbone/resources/sessions"
if [[ ! -L "/app/www/public/resources/sessions" ]]; then
cp -nR "/app/www/public/resources/sessions" "/config/www/xbackbone/resources/sessions" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/resources/sessions"
ln -s "/config/www/xbackbone/resources/sessions" "/app/www/public/resources/sessions"
fi

if [[ ! -L "/app/www/public/static/bootstrap" ]]; then
cp -nR "/app/www/public/static/bootstrap" "/config/www/xbackbone/static/bootstrap"
if [[ ! -L "/app/www/public/static/bootstrap" ]]; then
cp -nR "/app/www/public/static/bootstrap" "/config/www/xbackbone/static/bootstrap" 2> >(grep -v 'cp: not replacing')
fi
rm -rf "/app/www/public/static/bootstrap"
ln -s "/config/www/xbackbone/static/bootstrap" "/app/www/public/static/bootstrap"
fi
Expand Down

0 comments on commit 3ce38a5

Please sign in to comment.