diff --git a/apache/Dockerfile b/apache/Dockerfile index c776d5a3..b6daf18c 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -1,6 +1,6 @@ -FROM httpd:2.4 +FROM httpd:2.4-alpine -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ +RUN apk add --no-cache --update \ nano \ openssl \ gettext diff --git a/apache/entrypoint.sh b/apache/entrypoint.sh index e0e16288..763a348b 100644 --- a/apache/entrypoint.sh +++ b/apache/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # if there's no ssl certificate yet create it if [ ! -f "/usr/local/apache2/conf/server.crt" ]; then diff --git a/docker-compose.yml b/docker-compose.yml index 4f520ab9..b96cb1ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: # docker-compose -f docker-compose.yml -f compose/nginx.yml -f compose/pgsql.yml -f compose/php.yml up -d pgsql php-7.3 nodejs: - image: node:16 + image: node:16-alpine container_name: totara_nodejs environment: TZ: ${TIME_ZONE} @@ -28,7 +28,7 @@ services: - totara redis: - image: redis + image: redis:alpine # activate persistency command: "redis-server --appendonly yes" environment: @@ -39,7 +39,7 @@ services: - totara memcached: - image: memcached + image: memcached:alpine environment: TZ: ${TIME_ZONE} networks: diff --git a/mssql/2017/Dockerfile b/mssql/2017/Dockerfile index 1951556f..cdcbbc2c 100644 --- a/mssql/2017/Dockerfile +++ b/mssql/2017/Dockerfile @@ -13,12 +13,14 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get install apt-transport-https && \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server.list && \ - apt-get update + rm -rf /var/lib/apt/lists/* # Install SQL Server which a prerequisite for the optional packages below. # Install full text search addons RUN export DEBIAN_FRONTEND=noninteractive && \ - apt-get install -y mssql-server mssql-server-ha mssql-server-fts + apt-get update && \ + apt-get install -y mssql-server mssql-server-ha mssql-server-fts && \ + rm -rf /var/lib/apt/lists/* # we need en_US locales for MSSQL connection to work RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ @@ -33,7 +35,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list && \ apt-get update && \ - ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools unixodbc-dev + ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools unixodbc-dev && \ + rm -rf /var/lib/apt/lists/* RUN mkdir /custom COPY custom /custom/ diff --git a/mssql/2019/Dockerfile b/mssql/2019/Dockerfile index 78e7180d..29693fdd 100644 --- a/mssql/2019/Dockerfile +++ b/mssql/2019/Dockerfile @@ -17,7 +17,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list | tee /etc/apt/sources.list.d/mssql-server.list && \ apt-get update && \ export DEBIAN_FRONTEND=noninteractive && \ - apt-get install -y mssql-server mssql-server-ha mssql-server-fts + apt-get install -y mssql-server mssql-server-ha mssql-server-fts && \ + rm -rf /var/lib/apt/lists/* # we need en_US locales for MSSQL connection to work RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ @@ -32,7 +33,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list && \ apt-get update && \ - ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools unixodbc-dev + ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools unixodbc-dev && \ + rm -rf /var/lib/apt/lists/* RUN mkdir /custom COPY custom /custom/ diff --git a/nginx/Dockerfile b/nginx/Dockerfile index b74cead6..3f5853e7 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,8 +1,8 @@ -FROM nginx:1.20 +FROM nginx:1.20-alpine ENV REMOTE_DATA=${REMOTE_DATA} -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ +RUN apk add --no-cache --update \ nano \ openssl \ gettext diff --git a/nginx/entrypoint.sh b/nginx/entrypoint.sh index e970557f..c9497fd9 100644 --- a/nginx/entrypoint.sh +++ b/nginx/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # if there's no ssl certificate yet create it if [ ! -f "/etc/nginx/ssl/domain.crt" ] diff --git a/php/php80/Dockerfile b/php/php80/Dockerfile index f75410dd..5665b13f 100644 --- a/php/php80/Dockerfile +++ b/php/php80/Dockerfile @@ -1,36 +1,56 @@ -FROM php:8.0-fpm-bullseye +FROM php:8.0-fpm-alpine +ARG TARGETARCH ARG TIME_ZONE=Pacific/Auckland -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - apt-transport-https \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxml2-dev \ - libicu-dev \ - libpq-dev \ - gnupg2 \ +RUN apk add --no-cache --update \ + linux-headers \ + aspell \ + autoconf \ + bash \ + bc \ + curl \ + icu \ + icu-data-full \ + freetds \ + freetype \ + ghostscript \ + git \ + gnupg \ + graphviz \ + libldap \ + libjpeg \ + libmcrypt \ + libmemcached \ + libpng \ + libpq \ + musl \ + musl-utils \ + musl-locales \ + musl-locales-lang \ nano \ - vim \ - wget \ openssl \ - locales \ tzdata \ - git \ + vim \ + wget \ + zip + +RUN apk add --no-cache --update --virtual build-dependencies \ + curl-dev \ + freetype-dev \ + freetds-dev \ + libjpeg-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libpq-dev \ + libxml2-dev \ libzip-dev \ - libmemcached-dev \ - zip \ - netcat \ - bc \ - ghostscript \ - graphviz \ - aspell \ - libldap2-dev \ - libltdl-dev \ - && docker-php-ext-install -j$(nproc) \ - zip \ + icu-dev \ + openldap-dev \ + gcc \ + make \ + g++ && \ + docker-php-ext-install -j$(nproc) zip \ intl \ soap \ opcache \ @@ -40,69 +60,80 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ mysqli \ exif \ ldap \ - && docker-php-ext-configure gd \ + pdo_dblib && \ + docker-php-ext-configure gd \ --with-freetype \ - --with-jpeg \ - && docker-php-ext-install -j$(nproc) gd - -RUN git clone https://github.com/tideways/php-profiler-extension.git \ - && cd php-profiler-extension \ - && phpize \ - && ./configure \ - && make && make install + --with-jpeg && \ + docker-php-ext-install -j$(nproc) gd && \ + apk del build-dependencies + +RUN apk add --no-cache --update --virtual build-dependencies \ + gcc \ + make \ + g++ \ + libmemcached-dev \ + libzip-dev \ + pkgconfig && \ + git clone https://github.com/tideways/php-profiler-extension.git && \ + cd php-profiler-extension && \ + phpize && \ + ./configure && \ + make && make install && \ + pecl install -o -f redis && \ + pecl install -o -f igbinary && \ + pecl install -o -f memcached && \ + rm -rf /tmp/pear && \ + apk del build-dependencies RUN echo "extension=tideways_xhprof.so" >> /usr/local/etc/php/conf.d/tideways_xhprof.ini -RUN pecl install -o -f redis \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable redis - -RUN pecl install -o -f igbinary \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable igbinary - -RUN pecl install -o -f memcached \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable memcached - -# we need en_US locales for MSSQL connection to work -# we need en_AU locales for behat to work -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - sed -i -e 's/# en_AU.UTF-8 UTF-8/en_AU.UTF-8 UTF-8/' /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=en_US.UTF-8 +RUN docker-php-ext-enable redis && \ + docker-php-ext-enable igbinary && \ + docker-php-ext-enable memcached ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -# install mssql extension -RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ - && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ - && apt-get update && ACCEPT_EULA=Y apt-get install -y \ - msodbcsql18 \ - mssql-tools18 \ - unixodbc-dev +# Taken from https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$TARGETARCH.apk + +#(Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg': +RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.1.1-1_$TARGETARCH.sig && \ + curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$TARGETARCH.sig + +RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - && \ + gpg --verify msodbcsql18_18.3.1.1-1_$TARGETARCH.sig msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + gpg --verify mssql-tools18_18.3.1.1-1_$TARGETARCH.sig mssql-tools18_18.3.1.1-1_$TARGETARCH.apk + +# Install the package(s) +RUN apk add --allow-untrusted msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + apk add --allow-untrusted mssql-tools18_18.3.1.1-1_$TARGETARCH.apk -RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \ - && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc +RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile && \ + echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc -# Workaround applied: https://github.com/microsoft/msphpsql/issues/1438#issuecomment-1444773949 -RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \ - && pecl install sqlsrv-5.10.1 pdo_sqlsrv-5.10.1 || \ - apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 && \ - pecl install sqlsrv-5.10.1 pdo_sqlsrv-5.10.1 +RUN apk add --no-cache --update --virtual build-dependencies \ + gcc \ + make \ + g++ \ + unixodbc-dev && \ + pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system && \ + pecl install sqlsrv && \ + pecl install pdo_sqlsrv && \ + rm -rf /tmp/pear && \ + apk del build-dependencies RUN docker-php-ext-enable sqlsrv.so && docker-php-ext-enable pdo_sqlsrv.so -RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \ - && dpkg-reconfigure --frontend noninteractive tzdata +RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime -# Python 3.7 for ML Recommender. -RUN apt-get update && apt install -y python3 \ - python3-pip \ - python3-wheel \ - python3-venv \ +# Python 3 for ML Recommender. +RUN apk add --no-cache --update python3 \ + py3-pip \ + py3-wheel \ + py3-virtualenv \ python3-dev COPY config/php.ini /usr/local/etc/php/ @@ -112,7 +143,7 @@ COPY config/fpm.conf /usr/local/etc/php-fpm.d/zz-totara.conf RUN echo 'for f in ~/custom_shell/*.sh; do [[ -e "$f" ]] && source "$f"; done;' >> ~/.bashrc # Have the option of using the oh my zsh shell. -RUN apt-get update && apt-get install -y zsh +RUN apk add --no-cache --update zsh RUN sh -c "$(curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --unattended RUN git clone https://github.com/romkatv/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k RUN git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions diff --git a/php/php81/Dockerfile b/php/php81/Dockerfile index 8a25a94e..92ff5bb4 100644 --- a/php/php81/Dockerfile +++ b/php/php81/Dockerfile @@ -1,36 +1,56 @@ -FROM php:8.1-fpm-bullseye +FROM php:8.1-fpm-alpine +ARG TARGETARCH ARG TIME_ZONE=Pacific/Auckland -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - apt-transport-https \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxml2-dev \ - libicu-dev \ - libpq-dev \ - gnupg2 \ +RUN apk add --no-cache --update \ + linux-headers \ + aspell \ + autoconf \ + bash \ + bc \ + curl \ + icu \ + icu-data-full \ + freetds \ + freetype \ + ghostscript \ + git \ + gnupg \ + graphviz \ + libldap \ + libjpeg \ + libmcrypt \ + libmemcached \ + libpng \ + libpq \ + musl \ + musl-utils \ + musl-locales \ + musl-locales-lang \ nano \ - vim \ - wget \ openssl \ - locales \ tzdata \ - git \ + vim \ + wget \ + zip + +RUN apk add --no-cache --update --virtual build-dependencies \ + curl-dev \ + freetype-dev \ + freetds-dev \ + libjpeg-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libpq-dev \ + libxml2-dev \ libzip-dev \ - libmemcached-dev \ - zip \ - netcat \ - bc \ - ghostscript \ - graphviz \ - aspell \ - libldap2-dev \ - libltdl-dev \ - && docker-php-ext-install -j$(nproc) \ - zip \ + icu-dev \ + openldap-dev \ + gcc \ + make \ + g++ && \ + docker-php-ext-install -j$(nproc) zip \ intl \ soap \ opcache \ @@ -40,69 +60,80 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ mysqli \ exif \ ldap \ - && docker-php-ext-configure gd \ + pdo_dblib && \ + docker-php-ext-configure gd \ --with-freetype \ - --with-jpeg \ - && docker-php-ext-install -j$(nproc) gd - -RUN git clone https://github.com/tideways/php-profiler-extension.git \ - && cd php-profiler-extension \ - && phpize \ - && ./configure \ - && make && make install + --with-jpeg && \ + docker-php-ext-install -j$(nproc) gd && \ + apk del build-dependencies + +RUN apk add --no-cache --update --virtual build-dependencies \ + gcc \ + make \ + g++ \ + libmemcached-dev \ + libzip-dev \ + pkgconfig && \ + git clone https://github.com/tideways/php-profiler-extension.git && \ + cd php-profiler-extension && \ + phpize && \ + ./configure && \ + make && make install && \ + pecl install -o -f redis && \ + pecl install -o -f igbinary && \ + pecl install -o -f memcached && \ + rm -rf /tmp/pear && \ + apk del build-dependencies RUN echo "extension=tideways_xhprof.so" >> /usr/local/etc/php/conf.d/tideways_xhprof.ini -RUN pecl install -o -f redis \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable redis - -RUN pecl install -o -f igbinary \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable igbinary - -RUN pecl install -o -f memcached \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable memcached - -# we need en_US locales for MSSQL connection to work -# we need en_AU locales for behat to work -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - sed -i -e 's/# en_AU.UTF-8 UTF-8/en_AU.UTF-8 UTF-8/' /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=en_US.UTF-8 +RUN docker-php-ext-enable redis && \ + docker-php-ext-enable igbinary && \ + docker-php-ext-enable memcached ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -# install mssql extension -RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ - && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ - && apt-get update && ACCEPT_EULA=Y apt-get install -y \ - msodbcsql18 \ - mssql-tools18 \ - unixodbc-dev +# Taken from https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$TARGETARCH.apk + +#(Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg': +RUN curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.1.1-1_$TARGETARCH.sig && \ + curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$TARGETARCH.sig + +RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - && \ + gpg --verify msodbcsql18_18.3.1.1-1_$TARGETARCH.sig msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + gpg --verify mssql-tools18_18.3.1.1-1_$TARGETARCH.sig mssql-tools18_18.3.1.1-1_$TARGETARCH.apk + +# Install the package(s) +RUN apk add --allow-untrusted msodbcsql18_18.3.1.1-1_$TARGETARCH.apk && \ + apk add --allow-untrusted mssql-tools18_18.3.1.1-1_$TARGETARCH.apk -RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \ - && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc +RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile && \ + echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc -# Workaround applied: https://github.com/microsoft/msphpsql/issues/1438#issuecomment-1444773949 -RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \ - && pecl install sqlsrv-5.10.1 pdo_sqlsrv-5.10.1 || \ - apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 && \ - pecl install sqlsrv-5.10.1 pdo_sqlsrv-5.10.1 +RUN apk add --no-cache --update --virtual build-dependencies \ + gcc \ + make \ + g++ \ + unixodbc-dev && \ + pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system && \ + pecl install sqlsrv && \ + pecl install pdo_sqlsrv && \ + rm -rf /tmp/pear && \ + apk del build-dependencies RUN docker-php-ext-enable sqlsrv.so && docker-php-ext-enable pdo_sqlsrv.so -RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \ - && dpkg-reconfigure --frontend noninteractive tzdata +RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime -# Python 3.7 for ML Recommender. -RUN apt-get update && apt install -y python3 \ - python3-pip \ - python3-wheel \ - python3-venv \ +# Python 3 for ML Recommender. +RUN apk add --no-cache --update python3 \ + py3-pip \ + py3-wheel \ + py3-virtualenv \ python3-dev COPY config/php.ini /usr/local/etc/php/ @@ -112,7 +143,7 @@ COPY config/fpm.conf /usr/local/etc/php-fpm.d/zz-totara.conf RUN echo 'for f in ~/custom_shell/*.sh; do [[ -e "$f" ]] && source "$f"; done;' >> ~/.bashrc # Have the option of using the oh my zsh shell. -RUN apt-get update && apt-get install -y zsh +RUN apk add --no-cache --update zsh RUN sh -c "$(curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --unattended RUN git clone https://github.com/romkatv/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k RUN git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions diff --git a/shell/.zshrc b/shell/.zshrc index 73edf339..31029705 100644 --- a/shell/.zshrc +++ b/shell/.zshrc @@ -54,7 +54,7 @@ POWERLEVEL9K_CUSTOM_TOTARA_FOREGROUND="black" zsh_dir_name(){ local diricon='\uf07c' local dirfull=$(pwd) - local dir=$(echo "$dirfull" | grep -oP "^/var/www/totara/\K.*") + local dir="${dirfull/\/var\/www\/totara\//"$"}" if [[ -z "$dir" ]]; then dir="$dirfull"; fi