diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index f3090f2dde..2f84cb7e5f 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -2936,8 +2936,8 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" if To_Install 190 # Beets then # Config: Preserve existing on reinstall - [[ -d '/mnt/dietpi_userdata/beets' ]] || G_EXEC mkdir /mnt/dietpi_userdata/beets - [[ -f '/mnt/dietpi_userdata/beets/config.yaml' ]] || echo -e 'directory: /mnt/dietpi_userdata/Music\nlibrary: /mnt/dietpi_userdata/beets/library.db' > /mnt/dietpi_userdata/beets/config.yaml + G_EXEC mkdir -p /mnt/dietpi_userdata/beets + [[ -f '/mnt/dietpi_userdata/beets/config.yaml' ]] || G_EXEC eval 'echo -e '\''directory: /mnt/dietpi_userdata/Music\nlibrary: /mnt/dietpi_userdata/beets/library.db'\'' > /mnt/dietpi_userdata/beets/config.yaml' # Allow dietpi user and audio group members to manage library [[ -f '/mnt/dietpi_userdata/beets/library.db' ]] || > /mnt/dietpi_userdata/beets/library.db @@ -3446,7 +3446,7 @@ _EOF_ # - Remove previous disk cache dir or symlink G_EXEC rm -Rf /var/cache/samba # - Pre-create RAM cache dir - [[ -d '/run/samba-cache' ]] || G_EXEC mkdir /run/samba-cache + G_EXEC mkdir -p /run/samba-cache # - Link disk cache to RAM G_EXEC ln -s /run/samba-cache /var/cache/samba # - Create RAM cache dir automatically on boot @@ -3482,8 +3482,8 @@ _EOF_ G_AGI nfs-kernel-server G_EXEC systemctl stop nfs-kernel-server - [[ -d '/etc/exports.d' ]] || G_EXEC mkdir /etc/exports.d - [[ -f '/etc/exports.d/dietpi.exports' ]] || echo '/mnt/dietpi_userdata *(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)' > /etc/exports.d/dietpi.exports + G_EXEC mkdir -p /etc/exports.d + [[ -f '/etc/exports.d/dietpi.exports' ]] || G_EXEC 'echo '\''/mnt/dietpi_userdata *(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)'\'' > /etc/exports.d/dietpi.exports' fi if To_Install 83 apache2 # Apache @@ -3491,7 +3491,7 @@ _EOF_ # Pre-create a dummy port 80 vhost if it does not exist yet, so we can avoid overwriting it on reinstalls. if [[ ! -f '/etc/apache2/sites-available/000-default.conf' ]] then - [[ -d '/etc/apache2/sites-available' ]] || G_EXEC mkdir -p /etc/apache2/sites-available + G_EXEC mkdir -p /etc/apache2/sites-available cat << _EOF_ > /etc/apache2/sites-available/000-default.conf # /etc/apache2/sites-available/000-default.conf @@ -3580,7 +3580,7 @@ _EOF_ G_EXEC systemctl stop nginx # Custom configs, included by sites-enabled/default within server directive, while nginx/(conf.d|sites-enabled) is included by nginx.conf outside server directive - [[ -d '/etc/nginx/sites-dietpi' ]] || G_EXEC mkdir /etc/nginx/sites-dietpi + G_EXEC mkdir -p /etc/nginx/sites-dietpi G_BACKUP_FP /etc/nginx/nginx.conf dps_index=$software_id Download_Install 'nginx.conf' /etc/nginx/nginx.conf @@ -3918,7 +3918,7 @@ _EOF_ fi # Pre-create TempDir: https://docs.phpmyadmin.net/en/latest/config.html#cfg_TempDir - [[ -d '/var/www/phpmyadmin/tmp' ]] || G_EXEC mkdir /var/www/phpmyadmin/tmp + G_EXEC mkdir -p /var/www/phpmyadmin/tmp G_EXEC chown www-data:root /var/www/phpmyadmin/tmp G_EXEC chmod 700 /var/www/phpmyadmin/tmp fi @@ -4194,7 +4194,7 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC go-ipfs/install.sh # Data and config directory - [[ -d '/mnt/dietpi_userdata/ipfs' ]] || G_EXEC mkdir /mnt/dietpi_userdata/ipfs + G_EXEC mkdir -p /mnt/dietpi_userdata/ipfs # User Create_User -d /mnt/dietpi_userdata/ipfs ipfs @@ -4383,7 +4383,7 @@ _EOF_ # Prepare our new config + data directory if not yet present if [[ ! -f '/mnt/dietpi_userdata/fahclient/config.xml' ]] then - [[ -d '/mnt/dietpi_userdata/fahclient' ]] || G_EXEC mkdir /mnt/dietpi_userdata/fahclient + G_EXEC mkdir -p /mnt/dietpi_userdata/fahclient dps_index=$software_id Download_Install 'config.xml' /mnt/dietpi_userdata/fahclient/config.xml fi @@ -5199,12 +5199,12 @@ _EOF_ then G_EXEC mv /var/lib/mopidy /mnt/dietpi_userdata/mopidy # Workaround error about moving data dir into itself - [[ -d '/mnt/dietpi_userdata/mopidy/.hidden_data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/.hidden_data + G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/.hidden_data # Non-hidden files/folders are data G_EXEC mv /mnt/dietpi_userdata/mopidy/* /mnt/dietpi_userdata/mopidy/.hidden_data G_EXEC mv /mnt/dietpi_userdata/mopidy/.hidden_data /mnt/dietpi_userdata/mopidy/data else - [[ -d '/mnt/dietpi_userdata/mopidy/data' ]] || G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data + G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data [[ -d '/var/lib/mopidy' ]] && G_EXEC rm -R /var/lib/mopidy fi @@ -5213,7 +5213,7 @@ _EOF_ then G_EXEC mv /var/cache/mopidy /mnt/dietpi_userdata/mopidy/cache else - [[ -d '/mnt/dietpi_userdata/mopidy/cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/cache + G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/cache [[ -d '/var/cache/mopidy' ]] && G_EXEC rm -R /var/cache/mopidy fi @@ -5483,7 +5483,7 @@ _EOF_ [[ -f 'www/status_mjpeg.txt' ]] && G_EXEC rm www/status_mjpeg.txt # Web base dir - [[ -d '/var/www/rpicam' ]] || G_EXEC mkdir /var/www/rpicam + G_EXEC mkdir -p /var/www/rpicam G_EXEC cp -dR www/. /var/www/rpicam/ [[ -e '/var/www/rpicam/FIFO' ]] || G_EXEC mknod /var/www/rpicam/FIFO p [[ -e '/var/www/rpicam/FIFO1' ]] || G_EXEC mknod /var/www/rpicam/FIFO1 p @@ -5524,7 +5524,7 @@ _EOF_ G_EXEC rm -R RPi_Cam_Web_Interface-master # Data directory - [[ -d '/mnt/dietpi_userdata/rpicam' ]] || G_EXEC mkdir /mnt/dietpi_userdata/rpicam + G_EXEC mkdir -p /mnt/dietpi_userdata/rpicam G_EXEC rm -Rf /var/www/rpicam/media G_EXEC ln -s /mnt/dietpi_userdata/rpicam /var/www/rpicam/media @@ -6331,7 +6331,7 @@ ExecStart=/usr/bin/java -Xmx${memory_limit}m -Dairsonic.home=/mnt/dietpi_userdat WantedBy=multi-user.target _EOF_ # Enable FFmpeg transcode - [[ -d '/mnt/dietpi_userdata/airsonic/transcode' ]] || G_EXEC mkdir /mnt/dietpi_userdata/airsonic/transcode + G_EXEC mkdir -p /mnt/dietpi_userdata/airsonic/transcode [[ -f '/mnt/dietpi_userdata/airsonic/transcode/ffmpeg' ]] || G_EXEC ln -sf "$(command -v ffmpeg)" /mnt/dietpi_userdata/airsonic/transcode # Permissions @@ -6354,7 +6354,7 @@ _EOF_ Download_Install "$(curl -sSfL 'https://api.github.com/repos/navidrome/navidrome/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/navidrome_[0-9.]*_Linux_$arch\.tar\.gz\"/{print \$4}")" /opt/navidrome # Data dir - [[ -d '/mnt/dietpi_userdata/navidrome' ]] || G_EXEC mkdir /mnt/dietpi_userdata/navidrome + G_EXEC mkdir -p /mnt/dietpi_userdata/navidrome # User Create_User -g dietpi -d /mnt/dietpi_userdata/navidrome navidrome @@ -6540,7 +6540,7 @@ See the manual below for instructions on how to do this. then Download_Install 'https://github.com/WiringPi/WiringPi/archive/master.tar.gz' G_EXEC cd WiringPi-master - [[ -d '/usr/local/include' ]] || G_EXEC mkdir /usr/local/include + G_EXEC mkdir -p /usr/local/include G_EXEC_OUTPUT=1 G_EXEC ./build # Odroids @@ -6673,7 +6673,7 @@ _EOF_ done local mode=$G_WHIP_RETURNED_VALUE - [[ -d '/etc/frp' ]] || G_EXEC mkdir /etc/frp + G_EXEC mkdir -p /etc/frp Create_User frp -d /etc/frp local token= @@ -7375,7 +7375,7 @@ _EOF_ # TigerVNC: Set control + read-only passwords if [[ ${aSOFTWARE_INSTALL_STATE[28]} == 1 && ! -f '/root/.vnc/passwd' ]] then - [[ -d '/root/.vnc' ]] || G_EXEC mkdir /root/.vnc + G_EXEC mkdir -p /root/.vnc tigervncpasswd -f <<< "$GLOBAL_PW $GLOBAL_PW" > /root/.vnc/passwd G_EXEC chmod 600 /root/.vnc/passwd @@ -7395,7 +7395,7 @@ $GLOBAL_PW" if To_Install 73 fail2ban # Fail2Ban then # Create jail.conf (backend = systemd) first, to prevent APT failure due to missing /var/log/auth.log: https://github.com/MichaIng/DietPi/issues/475#issuecomment-310873879 - [[ -d '/etc/fail2ban/fail2ban.d' ]] || G_EXEC mkdir -p /etc/fail2ban/fail2ban.d + G_EXEC mkdir -p /etc/fail2ban/fail2ban.d [[ -f '/etc/fail2ban/jail.conf' ]] || cat << '_EOF_' > /etc/fail2ban/jail.conf [DEFAULT] enabled = true @@ -7526,7 +7526,7 @@ _EOF_ G_EXEC curl -sSfL 'https://vaemendis.net/ubooquity/service/download.php' -o Ubooquity.zip G_EXEC unzip -o Ubooquity.zip G_EXEC rm Ubooquity.zip - [[ -d '/mnt/dietpi_userdata/ubooquity' ]] || G_EXEC mkdir /mnt/dietpi_userdata/ubooquity + G_EXEC mkdir -p /mnt/dietpi_userdata/ubooquity G_EXEC mv {,/mnt/dietpi_userdata/ubooquity/}Ubooquity.jar # User @@ -7652,9 +7652,9 @@ _EOF_ unset -v phrase # Create test galleries - [[ -d '/var/www/gallery/DietPi' ]] || G_EXEC mkdir /var/www/gallery/DietPi + G_EXEC mkdir -p /var/www/gallery/DietPi [[ -f '/var/www/gallery/DietPi/logo_256.png' ]] || G_THREAD_START curl -sSf 'https://dietpi.com/images/dietpi-logo_256x256.png' -o /var/www/gallery/DietPi/logo_256.png - [[ -d '/var/www/gallery/Tr-Zero' ]] || G_EXEC mkdir /var/www/gallery/Tr-Zero + G_EXEC mkdir -p /var/www/gallery/Tr-Zero [[ -f '/var/www/gallery/Tr-Zero/SS_0.jpg' ]] || G_THREAD_START curl -sSfL 'https://media.indiedb.com/images/games/1/25/24673/SS_0.jpg' -o /var/www/gallery/Tr-Zero/SS_0.jpg [[ -f '/var/www/gallery/Tr-Zero/SS_1.jpg' ]] || G_THREAD_START curl -sSfL 'https://media.indiedb.com/images/games/1/25/24673/SS_44.jpg' -o /var/www/gallery/Tr-Zero/SS_1.jpg [[ -f '/var/www/gallery/Tr-Zero/SS_2.jpg' ]] || G_THREAD_START curl -sSfL 'https://media.indiedb.com/images/games/1/25/24673/3.png' -o /var/www/gallery/Tr-Zero/SS_2.jpg @@ -8435,7 +8435,7 @@ location = /.well-known/caldav { return 301 /baikal/html/dav.php; }' > /etc/ngi # User: Run service as "dietpi" group: https://github.com/MichaIng/DietPi/issues/350#issuecomment-423763518 Create_User -g dietpi -G plex,video,render -d /var/lib/plexmediaserver plex # - Unset explicit group in service file (applied by DEB package) as this may override supplementary group permissions - [[ -d '/etc/systemd/system/plexmediaserver.service.d' ]] || G_EXEC mkdir /etc/systemd/system/plexmediaserver.service.d + G_EXEC mkdir -p /etc/systemd/system/plexmediaserver.service.d G_EXEC eval 'echo -e '\''[Service]\nGroup='\'' > /etc/systemd/system/plexmediaserver.service.d/dietpi-group.conf' # Unbound: Fix secure remote access: https://dietpi.com/forum/t/cant-connect-to-plex-directly-due-to-unbound/5199 @@ -8503,7 +8503,7 @@ _EOF_ G_AGI rdiff-backup rsync screen make g++ "${python[@]}" # Download/Update MineOS - [[ -d '/mnt/dietpi_userdata/mineos' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mineos + G_EXEC mkdir -p /mnt/dietpi_userdata/mineos G_EXEC cd /mnt/dietpi_userdata/mineos if [[ -d 'minecraft' ]] then @@ -8882,7 +8882,7 @@ _EOF_ G_CONFIG_INJECT '"curl"[[:blank:]]' ' "curl" => "/usr/bin/curl",' /var/www/rutorrent/conf/config.php # Session dir - [[ -d '/mnt/dietpi_userdata/downloads/.session' ]] || G_EXEC mkdir /mnt/dietpi_userdata/downloads/.session + G_EXEC mkdir -p /mnt/dietpi_userdata/downloads/.session # User Create_User -g dietpi -d /mnt/dietpi_userdata/rtorrent rtorrent @@ -8906,7 +8906,7 @@ _EOF_ # - Deprecated commands: # https://github.com/rakshasa/rtorrent/wiki/rTorrent-0.9-Comprehensive-Command-list-(WIP) # https://github.com/rakshasa/rtorrent/blob/master/doc/scripts/update_commands_0.9.sed - [[ -d '/mnt/dietpi_userdata/rtorrent' ]] || G_EXEC mkdir /mnt/dietpi_userdata/rtorrent + G_EXEC mkdir -p /mnt/dietpi_userdata/rtorrent if [[ -f '/mnt/dietpi_userdata/rtorrent/.rtorrent.rc' ]] then # In case dist-upgraded systems, assure that daemon mode is enabled @@ -8991,7 +8991,7 @@ _EOF_ Create_User -g dietpi -d /mnt/dietpi_userdata/aria2 aria2 # Config - [[ -d '/mnt/dietpi_userdata/aria2' ]] || G_EXEC mkdir /mnt/dietpi_userdata/aria2 + G_EXEC mkdir -p /mnt/dietpi_userdata/aria2 [[ -f '/mnt/dietpi_userdata/aria2/aria2.conf' ]] || cat << _EOF_ > /mnt/dietpi_userdata/aria2/aria2.conf # DietPi default aria2c options served as aria2.conf file via --conf-path # https://aria2.github.io/manual/en/html/aria2c.html#options @@ -9665,7 +9665,7 @@ _EOF_ [[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.db.bak' ]] && G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.db.bak # Data dir - [[ -d '/mnt/dietpi_userdata/sonarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/sonarr + G_EXEC mkdir -p /mnt/dietpi_userdata/sonarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/sonarr sonarr @@ -9766,7 +9766,7 @@ _EOF_ [[ -f '/mnt/dietpi_userdata/radarr/nzbdrone.db.bak' ]] && G_EXEC rm /mnt/dietpi_userdata/radarr/nzbdrone.db.bak # Data dir - [[ -d '/mnt/dietpi_userdata/radarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/radarr + G_EXEC mkdir -p /mnt/dietpi_userdata/radarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/radarr radarr @@ -9869,7 +9869,7 @@ _EOF_ fi # Data dir - [[ -d '/mnt/dietpi_userdata/lidarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/lidarr + G_EXEC mkdir -p /mnt/dietpi_userdata/lidarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/lidarr lidarr @@ -10026,7 +10026,7 @@ _EOF_ Create_User -d /mnt/dietpi_userdata/tautulli tautulli # Directory - [[ -d '/mnt/dietpi_userdata/tautulli' ]] || G_EXEC mkdir /mnt/dietpi_userdata/tautulli + G_EXEC mkdir -p /mnt/dietpi_userdata/tautulli # Service: https://github.com/Tautulli/Tautulli/blob/master/init-scripts/init.systemd cat << '_EOF_' > /etc/systemd/system/tautulli.service @@ -10209,7 +10209,7 @@ _EOF_ fi # Data dir - [[ -d '/mnt/dietpi_userdata/prowlarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/prowlarr + G_EXEC mkdir -p /mnt/dietpi_userdata/prowlarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/prowlarr prowlarr @@ -10284,7 +10284,7 @@ _EOF_ fi # Data dir - [[ -d '/mnt/dietpi_userdata/readarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/readarr + G_EXEC mkdir -p /mnt/dietpi_userdata/readarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/readarr readarr @@ -10407,7 +10407,7 @@ _EOF_ # Pre-create user and its home directory to allow user-level Python instance Create_User -G dialout,tty,video -d /mnt/dietpi_userdata/octoprint octoprint - [[ -d '/mnt/dietpi_userdata/octoprint' ]] || G_EXEC mkdir /mnt/dietpi_userdata/octoprint + G_EXEC mkdir -p /mnt/dietpi_userdata/octoprint G_EXEC chown -R octoprint:octoprint /mnt/dietpi_userdata/octoprint # Clear pip cache in case it got somehow created @@ -10635,7 +10635,7 @@ _EOF_ G_EXEC systemctl start docker.socket # Change Docker service type to "simple": https://github.com/MichaIng/DietPi/issues/2238#issuecomment-439474766 - [[ -d '/lib/systemd/system/docker.service.d' ]] || G_EXEC mkdir /lib/systemd/system/docker.service.d + G_EXEC mkdir -p /lib/systemd/system/docker.service.d G_EXEC eval "echo -e '[Service]\nType=simple' > /lib/systemd/system/docker.service.d/dietpi-simple.conf" # Config: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file @@ -10650,7 +10650,7 @@ _EOF_ GCI_PRESERVE=1 G_CONFIG_INJECT '"log-level":' ' "log-level": "warn",' /etc/docker/daemon.json '^\{([[:space:]]|$)' GCI_PRESERVE=1 G_CONFIG_INJECT '"debug":' ' "debug": false,' /etc/docker/daemon.json '^\{([[:space:]]|$)' else - [[ -d '/etc/docker' ]] || G_EXEC mkdir /etc/docker + G_EXEC mkdir -p /etc/docker echo '{ "data-root": "/mnt/dietpi_userdata/docker-data", "log-driver": "journald", @@ -11073,7 +11073,7 @@ _EOF_ if To_Install 86 roon-extension-manager # Roon Extension Manager then # Data dir - [[ -d '/mnt/dietpi_userdata/roon-extension-manager' ]] || G_EXEC mkdir /mnt/dietpi_userdata/roon-extension-manager + G_EXEC mkdir -p /mnt/dietpi_userdata/roon-extension-manager # Pre-v8.2 migration if [[ -f '/etc/systemd/system/roon-extension-manager.service' ]] @@ -11137,7 +11137,7 @@ _EOF_ [[ -d '/var/lib/jellyfin' ]] && G_EXEC mv /var/lib/jellyfin /mnt/dietpi_userdata/jellyfin || G_EXEC mkdir /mnt/dietpi_userdata/jellyfin G_CONFIG_INJECT 'JELLYFIN_DATA_DIR=' 'JELLYFIN_DATA_DIR=/mnt/dietpi_userdata/jellyfin' /etc/default/jellyfin # Change default WorkingDirectory - [[ -d '/etc/systemd/system/jellyfin.service.d' ]] || G_EXEC mkdir /etc/systemd/system/jellyfin.service.d + G_EXEC mkdir -p /etc/systemd/system/jellyfin.service.d G_EXEC eval 'echo -e '\''[Service]\nWorkingDirectory=/mnt/dietpi_userdata/jellyfin'\'' > /etc/systemd/system/jellyfin.service.d/dietpi.conf' # Cache dir # shellcheck disable=SC2015 @@ -11529,7 +11529,7 @@ _EOF_ # Download HACS Download_Install 'https://github.com/hacs/integration/releases/latest/download/hacs.zip' hacs [[ -d '/mnt/dietpi_userdata/homeassistant/custom_components/hacs' ]] && G_EXEC rm -R /mnt/dietpi_userdata/homeassistant/custom_components/hacs - [[ -d '/mnt/dietpi_userdata/homeassistant/custom_components' ]] || G_EXEC mkdir /mnt/dietpi_userdata/homeassistant/custom_components + G_EXEC mkdir -p /mnt/dietpi_userdata/homeassistant/custom_components G_EXEC mv hacs /mnt/dietpi_userdata/homeassistant/custom_components/ G_EXEC chown -R "$ha_user:$ha_user" /mnt/dietpi_userdata/homeassistant G_DIETPI-NOTIFY 2 "Home Assistant Community Store (HACS) has been installed in addition. To activate it, follow this guide: https://hacs.xyz/docs/configuration/basic/" @@ -11547,7 +11547,7 @@ _EOF_ #local file=$(curl -sSfL "$url/versions/$version/builds/$build"); file=${file##*\"name\":\"} file=${file%%\"*} # Download and install PaperMC Download_Install "$url/versions/$version/builds/$build/downloads/paper-$version-$build.jar" /opt/papermc/paperclip.jar - [[ -d '/mnt/dietpi_userdata/papermc' ]] || G_EXEC mkdir /mnt/dietpi_userdata/papermc + G_EXEC mkdir -p /mnt/dietpi_userdata/papermc G_EXEC eval 'echo "eula=true" > /mnt/dietpi_userdata/papermc/eula.txt' # User