Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

Commit 6b784d8

Browse files
committed
Updated ubuntu script with shellcheck guidance
- Also updated with more modern composer auto install. - Also installed composer to a global location
1 parent 821944e commit 6b784d8

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

scripts/installation-ubuntu-20.04.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# Fetch domain to use from first provided parameter,
66
# Otherwise request the user to input their domain
77
DOMAIN=$1
8-
if [ -z $1 ]
8+
if [ -z "$1" ]
99
then
1010
echo ""
1111
printf "Enter the domain you want to host BookStack and press [ENTER]\nExamples: my-site.com or docs.my-site.com\n"
12-
read DOMAIN
12+
read -r DOMAIN
1313
fi
1414

1515
# Get the current machine IP address
@@ -29,30 +29,29 @@ mysql -u root --execute="CREATE USER 'bookstack'@'localhost' IDENTIFIED WITH mys
2929
mysql -u root --execute="GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';FLUSH PRIVILEGES;"
3030

3131
# Download BookStack
32-
cd /var/www
32+
cd /var/www || exit
3333
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch bookstack
3434
BOOKSTACK_DIR="/var/www/bookstack"
35-
cd $BOOKSTACK_DIR
35+
cd $BOOKSTACK_DIR || exit
3636

3737
# Install composer
38-
EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
39-
curl -s https://getcomposer.org/installer > composer-setup.php
40-
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
38+
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
39+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
40+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
4141

42-
if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ]
42+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
4343
then
44-
php composer-setup.php --quiet
45-
RESULT=$?
46-
rm composer-setup.php
47-
else
48-
>&2 echo 'ERROR: Invalid composer installer signature'
44+
>&2 echo 'ERROR: Invalid composer installer checksum'
4945
rm composer-setup.php
5046
exit 1
5147
fi
5248

49+
# Move composer to global installation
50+
mv composer.phar /usr/local/bin/composer
51+
5352
# Install BookStack composer dependencies
5453
export COMPOSER_ALLOW_SUPERUSER=1
55-
php composer.phar install --no-dev --no-plugins
54+
php /usr/local/bin/composer install --no-dev --no-plugins
5655

5756
# Copy and update BookStack environment variables
5857
cp .env.example .env

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy