ajout des script de creation de l'environnement de dev Nextcloud
This commit is contained in:
68
nextcloud_devenv/runpodman.sh
Executable file
68
nextcloud_devenv/runpodman.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
source lib/metascript.sh
|
||||
|
||||
enforcedir polls exists
|
||||
|
||||
defaultmetainit $@
|
||||
|
||||
podman=podman
|
||||
nextcloud_image=nextcloud_local
|
||||
# same name than image
|
||||
container_name=$nextcloud_image
|
||||
|
||||
rel_bind_folder=bind_folder
|
||||
bind_folder=$(pwd)/$rel_bind_folder
|
||||
|
||||
declare -a podman_args
|
||||
|
||||
podman_args+=(-p 127.0.0.1:8080:80 --name=$container_name)
|
||||
|
||||
# container 33 www-data => current user.
|
||||
current_uid=$(id -u)
|
||||
current_gid=$(id -g)
|
||||
container_www_data_uid=33
|
||||
container_www_data_gid=33
|
||||
first_subuid=100000
|
||||
first_subgid=100000
|
||||
mapped_root_uid=$(( first_subuid + container_www_data_uid - 1 ))
|
||||
range_1=$(( container_www_data_uid - 1 ))
|
||||
|
||||
# does not work idmap requires CAP_SYS_ADMIN permission not set for standard user
|
||||
# www_data_idmap=",idmap=uids=0-${mapped_root_uid}-1#1-${first_subuid}-${range_1}#${container_www_data_uid}-${current_uid}-1#34-100033-2000;gids=0-${mapped_root_uid}-1#1-${first_subgid}-${range_1}#${container_www_data_gid}-${current_gid}-1#34-100033-2000"
|
||||
|
||||
# no theme yet
|
||||
for dir in nextcloud custom_apps config data
|
||||
do
|
||||
folder=${bind_folder}/$dir
|
||||
if [[ ! -f $folder ]]
|
||||
then
|
||||
mkdir -p $folder
|
||||
fi
|
||||
idmap=""
|
||||
if [[ $dir == nextcloud ]]
|
||||
then
|
||||
target=/var/www/html
|
||||
else
|
||||
target=/var/www/html/$dir
|
||||
if [[ $dir == custom_apps ]]
|
||||
then
|
||||
# current user will map to www-data for this binding
|
||||
idmap="$www_data_idmap"
|
||||
fi
|
||||
fi
|
||||
podman_args+=(--mount type=bind,source=${folder},target=${target}${idmap})
|
||||
done
|
||||
|
||||
# with root ...
|
||||
podman_args+=(--mount type=bind,source=$(pwd)/polls,target=/root/polls)
|
||||
|
||||
if [[ -n $detach ]]
|
||||
then
|
||||
podman_args+=(-d)
|
||||
fi
|
||||
|
||||
|
||||
echo "run podman with args ${podman_args[@]}"
|
||||
|
||||
$defer $podman run "${podman_args[@]}" $nextcloud_image
|
||||
Reference in New Issue
Block a user