Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e44b3a4

Browse files
committed
Create packagecheck.sh
It checks if package is installed
1 parent 7b05457 commit e44b3a4

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

‎docker-compose.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ services:
1717
- type: bind
1818
source: ./php-fpm/php-fpm.d/z-www.conf
1919
target: '${PHP_INI_DIR_PREFIX}/php-fpm.d/z-www.conf'
20+
- type: bind
21+
source: ./packagecheck.sh
22+
target: '/tmp/packagecheck.sh'
2023
hostname: symfony
2124
restart: unless-stopped
2225
ports:
@@ -35,7 +38,7 @@ services:
3538
labels:
3639
- 'docker-volume-backup.stop-during-backup=true'
3740
command: >
38-
bash -c "apt-get -y update && apt-get install -y zip unzip libicu-dev && docker-php-ext-install pdo_mysql intl && if pecl install -p -- redis; then pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis; fi; curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer &&
41+
bash -c "apt-get -y update && sh /tmp/packagecheck.sh 'zip unzip' && curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s intl pdo_mysql && if pecl install -p -- redis; then pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis; fi; curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer &&
3942
if [ -f \"${WEBSERVER_DOC_ROOT}/webapp/.env\" ]; then composer update --working-dir=${WEBSERVER_DOC_ROOT}/webapp; else composer create-project symfony/skeleton:"6.1.*" webapp && composer require --working-dir=${WEBSERVER_DOC_ROOT}/webapp ${SKELETON_WEBAPP} && cp ${WEBSERVER_DOC_ROOT}/htaccess ${WEBSERVER_DOC_ROOT}/webapp/public/.htaccess; fi;
4043
sed -i 's/DATABASE_URL=\"postgresql/# DATABASE_URL=\"postgresql/;s/# DATABASE_URL=\"mysql/DATABASE_URL=\"mysql/;s/app:/${DB_USER}:/;s/!ChangeMe!/${DB_PASSWORD}/;s/127.0.0.1/database/;s/app?/${DB_NAME}?/;s/serverVersion=.*\&charset/serverVersion=mariadb-10\&charset/' ${WEBSERVER_DOC_ROOT}/webapp/.env;
4144
grep -qe 'date.timezone = ${LOCAL_TIMEZONE}' ${PHP_INI_DIR_PREFIX}/php/conf.d/security.ini || echo 'date.timezone = ${LOCAL_TIMEZONE}' >> ${PHP_INI_DIR_PREFIX}/php/conf.d/security.ini; php-fpm"

‎packagecheck.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
PACKAGES=1ドル
4+
5+
notinstall_pkgs=""
6+
install=false
7+
8+
for pkg in $PACKAGES; do
9+
status="$(dpkg-query -W --showformat='${db:Status-Status}' "$pkg" 2>&1)"
10+
if [ ! $? = 0 ] || [ ! "$status" = installed ]; then
11+
install=true
12+
notinstall_pkgs=$pkg" "$notinstall_pkgs
13+
else
14+
installed_pkgs=$pkg" "$installed_pkgs
15+
fi
16+
done
17+
18+
if "$install"; then
19+
apt-get install -y --no-install-recommends $notinstall_pkgs && rm -rf /var/lib/apt/lists/*
20+
else
21+
echo "### WARNING ${installed_pkgs} Package[s] already installed. ###"
22+
fi

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /