Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM debian:bookworm-slim
FROM debian:forky-slim

# Suppress "unable to initialize frontend: Dialog" errors
ENV DEBIAN_FRONTEND=noninteractive

# Create the directory in which the scripts will be stored
RUN mkdir -p /opt/Nextcloud/log
Expand All @@ -8,6 +11,10 @@ RUN apt update \
&& apt -y upgrade \
&& apt install -yq --no-install-recommends \
moreutils \
mc \
nano \
locales \
locales-all \
&& apt clean \
&& apt -y autoremove \
&& rm -rf \
Expand All @@ -25,6 +32,7 @@ RUN apt update \
&& apt install -yq --no-install-recommends \
openssl \
ca-certificates \
procps \
nextcloud-desktop-cmd \
&& apt upgrade -y \
&& apt-get clean \
Expand All @@ -39,12 +47,24 @@ RUN apt update \
/usr/share/info \
/usr/share/lintian

COPY *.sh /opt/Nextcloud/
RUN locale-gen C.UTF-8

RUN echo 'alias ll="ls -l"\ alias ll="ls -l --color"\' >> ~/.bashrc

COPY docker-entrypoint.sh /opt/Nextcloud/
COPY run.sh /opt/Nextcloud/
COPY ini /root/.config/mc/

WORKDIR /nextclouddata

ENTRYPOINT ["/bin/bash","/opt/Nextcloud/docker-entrypoint.sh"]
CMD ["/bin/bash", "/opt/Nextcloud/run.sh"]

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LC_TIME=C.UTF-8
ENV LANGUAGE=C.UTF-8

ENV NEXTCLOUD_USER=NEXTCLOUD_username \
NEXTCLOUD_PASS=NEXTCLOUD_passwordORtoken \
NEXTCLOUD_SERVER=yourserver.com \
Expand All @@ -55,6 +75,7 @@ ENV NEXTCLOUD_USER=NEXTCLOUD_username \
TRUST_SELFSIGN=0 \
SYNC_HIDDEN=0 \
SILENCE_OUTPUT=1 \
RUN_INTERVAL=30 \
RUN_UID=99 \
RUN_GID=100
RUN_INTERVAL=120 \
DEBUG=0 \
RUN_UID=9001 \
RUN_GID=9001
50 changes: 32 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
occlient:
image: dyonr/nextcloudcmd-client
volumes:
- ${PWD}/mydata:/nextclouddata
environment:
- NEXTCLOUD_USER=myuser
- NEXTCLOUD_PASS=mypass
- NEXTCLOUD_PROTO=https
- NEXTCLOUD_SERVER=myocserver.com
- NEXTCLOUD_URLPATH=/
- NEXTCLOUD_WEBDAV=remote.php/webdav
- NEXTCLOUD_FILEPATH=/
- TRUST_SELFSIGN=0
- SYNC_HIDDEN=0
- SILENCE_OUTPUT=1
- RUN_INTERVAL=30
- RUN_UID=99
- RUN_GID=100
services:
occlient:
container_name: occlient
image: nextcloudcmd-client
env_file: ".env"
logging:
driver: journald
options:
max-size: "50mb"
volumes:
- ${VOLUME_MAPPING:-/home:/home}
- /opt/Nextcloud/log:/opt/Nextcloud/log
- /etc/localtime:/etc/localtime:ro
environment:
- NEXTCLOUD_USER=${NEXTCLOUD_USER:-admin}
- NEXTCLOUD_PASS=${NEXTCLOUD_PASS:-none}
- NEXTCLOUD_PROTO=${NEXTCLOUD_PROTO:-https}
- NEXTCLOUD_SERVER=${NEXTCLOUD_SERVER:-www.nextcloud.com}
- NEXTCLOUD_URLPATH=${NEXTCLOUD_URLPATH:-/}
- NEXTCLOUD_WEBDAV=${NEXTCLOUD_WEBDAV:-""}
- NEXTCLOUD_FILEPATH=${NEXTCLOUD_FILEPATH:-/}
- TRUST_SELFSIGN=${TRUST_SELFSIGN:-0}
- SYNC_HIDDEN=${SYNC_HIDDEN:-0}
- SILENCE_OUTPUT=${SILENCE_OUTPUT:-0}
- RUN_INTERVAL=${RUN_INTERVAL:-120}
- DEBUG=${DEBUG:-0}
- RUN_UID=${RUN_UID:-9001}
- RUN_GID=${RUN_GID:-9001}

restart: always

network_mode: "host"

49 changes: 31 additions & 18 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
#!/bin/bash

# Check if the PGID exists, if not create the group with the name 'nextcloudclient'
getent group "$RUN_GID" > /dev/null 2>&1
/usr/bin/getent group "$RUN_GID" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "[INFO] A group with PGID $RUN_GID already exists in /etc/group, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
echo "[INFO] A group with PGID $RUN_GID already exists in /etc/group, nothing to do." | /usr/bin/ts '%Y-%m-%d %H:%M:%.S'
else
echo "[INFO] A group with PGID $RUN_GID does not exist, adding a group called 'nextcloudclient' with PGID $RUN_GID" | ts '%Y-%m-%d %H:%M:%.S'
groupadd -g $RUN_GID nextcloudclient
echo "[INFO] A group with PGID $RUN_GID does not exist, adding a group called 'nextcloudclient' with PGID $RUN_GID" | /usr/bin/ts '%Y-%m-%d %H:%M:%.S'
/usr/sbin/groupadd -g $RUN_GID nextcloudclient
fi

# Check if the PUID exists, if not create the user with the name 'nextcloudclient', with the correct group
getent passwd "$RUN_UID" > /dev/null 2>&1
/usr/bin/getent passwd "$RUN_UID" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "[INFO] An user with PUID $RUN_UID already exists in /etc/passwd, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
echo "[INFO] An user with PUID $RUN_UID already exists in /etc/passwd, nothing to do." | /usr/bin/ts '%Y-%m-%d %H:%M:%.S'
else
echo "[INFO] An user with PUID $RUN_UID does not exist, adding an user called 'nextcloudclient user' with PUID $RUN_UID" | ts '%Y-%m-%d %H:%M:%.S'
useradd --comment "nextcloudclient user" --gid $RUN_GID --uid $RUN_UID --create-home --shell /bin/bash nextcloudclient
echo "[INFO] An user with PUID $RUN_UID does not exist, adding an user called 'nextcloudclient user' with PUID $RUN_UID" | /usr/bin/ts '%Y-%m-%d %H:%M:%.S'
/usr/sbin/useradd --comment "nextcloudclient user" --gid $RUN_GID --uid $RUN_UID --create-home --shell /bin/bash nextcloudclient
fi


# If we end up with a \n in the file it will complain
netrc_tmp="/home/nextcloudclient/.netrctmp"
netrc_file="/home/nextcloudclient/.netrc"
nextcloud_server_without_port=$(echo $NEXTCLOUD_SERVER | sed 's/\(.*\):.*/\1/')
cat <<EOF > $netrc_file
machine $nextcloud_server_without_port
login $NEXTCLOUD_USER
password $NEXTCLOUD_PASS
nextcloud_server_without_port=$(echo $NEXTCLOUD_SERVER | /usr/bin/sed 's/\(.*\):.*/\1/')
/usr/bin/cat <<EOF > $netrc_tmp
machine $nextcloud_server_without_port login $NEXTCLOUD_USER password $NEXTCLOUD_PASS
EOF
chown $RUN_UID:$RUN_GID $netrc_file
chmod 600 $netrc_file
/usr/bin/tr -d "\n" < $netrc_tmp > $netrc_file
/usr/bin/rm $netrc_tmp

/usr/bin/sed -i '1s/^/LANG="C.UTF-8"\nexport "LANG"\n/' /home/nextcloudclient/.bashrc

/usr/bin/chown $RUN_UID:$RUN_GID $netrc_file
/usr/bin/chmod 600 $netrc_file

echo "[INFO] Changing ownership of all files and directories in /nextclouddata and /opt/Nextcloud/log to $RUN_UID:$RUN_GID" | /usr/bin/ts '%Y-%m-%d %H:%M:%.S'

#SETUP PATHS
NC_PATH=(${NEXTCLOUD_FILEPATH})
for ((i = 0; i <= COUNT; i++)); do
FILEPATH=${NC_PATH[${i}]}
/usr/bin/chgrp -R $RUN_GID /nextclouddata/$FILEPATH/
done


echo "[INFO] Changing ownership of all files and directories in /nextclouddata and /opt/Nextcloud/log to $RUN_UID:$RUN_GID" | ts '%Y-%m-%d %H:%M:%.S'
chown -R $RUN_UID:$RUN_GID /nextclouddata /opt/Nextcloud/log
/usr/bin/chown -R $RUN_UID:$RUN_GID /opt/Nextcloud/log

exec $@
19 changes: 19 additions & 0 deletions env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NEXTCLOUD_USER=
NEXTCLOUD_PASS=
NEXTCLOUD_PROTO=https
NEXTCLOUD_SERVER=
NEXTCLOUD_URLPATH=/
NEXTCLOUD_WEBDAV=""
NEXTCLOUD_FILEPATH="dir1 dir2"
UPLIMIT=1024
DOWNLIMIT=1024
TRANSFERLIMIT=0
VOLUME_MAPPING=/host/dir:/nextclouddata
TRUST_SELFSIGN=0
SYNC_HIDDEN=0
SILENCE_OUTPUT=0
RUN_INTERVAL=20
JOB_INTERVAL=20
DEBUG=0
RUN_UID=9001
RUN_GID=9001
158 changes: 158 additions & 0 deletions ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
[Midnight-Commander]
verbose=true
shell_patterns=true
auto_save_setup=true
preallocate_space=false
auto_menu=false
use_internal_view=true
use_internal_edit=true
clear_before_exec=true
confirm_delete=true
confirm_overwrite=true
confirm_execute=false
confirm_history_cleanup=true
confirm_exit=false
confirm_directory_hotlist_delete=false
confirm_view_dir=false
safe_delete=false
use_8th_bit_as_meta=false
mouse_move_pages_viewer=true
mouse_close_dialog=false
fast_refresh=false
drop_menus=false
wrap_mode=true
old_esc_mode=true
cd_symlinks=true
show_all_if_ambiguous=false
use_file_to_guess_type=true
alternate_plus_minus=false
only_leading_plus_minus=true
show_output_starts_shell=false
xtree_mode=false
file_op_compute_totals=true
classic_progressbar=true
use_netrc=true
ftpfs_always_use_proxy=false
ftpfs_use_passive_connections=true
ftpfs_use_passive_connections_over_proxy=false
ftpfs_use_unix_list_options=true
ftpfs_first_cd_then_ls=true
ignore_ftp_chattr_errors=true
editor_fill_tabs_with_spaces=false
editor_return_does_auto_indent=true
editor_backspace_through_tabs=false
editor_fake_half_tabs=true
editor_option_save_position=true
editor_option_auto_para_formatting=false
editor_option_typewriter_wrap=false
editor_edit_confirm_save=true
editor_syntax_highlighting=false
editor_persistent_selections=true
editor_drop_selection_on_copy=true
editor_cursor_beyond_eol=false
editor_cursor_after_inserted_block=false
editor_visible_tabs=true
editor_visible_spaces=true
editor_line_state=false
editor_simple_statusbar=false
editor_check_new_line=false
editor_show_right_margin=false
editor_group_undo=false
editor_state_full_filename=false
editor_ask_filename_before_edit=false
nice_rotating_dash=true
mcview_remember_file_position=false
auto_fill_mkdir_name=true
copymove_persistent_attr=true
pause_after_run=1
mouse_repeat_rate=100
double_click_speed=250
old_esc_mode_timeout=1000000
max_dirt_limit=10
num_history_items_recorded=60
vfs_timeout=60
ftpfs_directory_timeout=900
ftpfs_retry_seconds=30
fish_directory_timeout=900
editor_tab_spacing=8
editor_word_wrap_line_length=72
editor_option_save_mode=0
editor_backup_extension=~
editor_filesize_threshold=64M
editor_stop_format_chars=-+*\\,.;:&>
mcview_eof=
skin=default

filepos_max_saved_entries=1024

[Layout]
message_visible=1
keybar_visible=1
xterm_title=1
output_lines=0
command_prompt=1
menubar_visible=1
free_space=1
horizontal_split=0
vertical_equal=1
left_panel_size=181
horizontal_equal=1
top_panel_size=1

[Misc]
timeformat_recent=%b %e %H:%M
timeformat_old=%b %e %Y
ftp_proxy_host=gate
ftpfs_password=anonymous@
display_codepage=UTF-8
source_codepage=Other_8_bit
autodetect_codeset=
spell_language=en
clipboard_store=
clipboard_paste=

[Colors]
base_color=
xterm-256color=
color_terminals=

linux=

[Panels]
show_mini_info=true
kilobyte_si=false
mix_all_files=false
show_backups=true
show_dot_files=true
fast_reload=false
fast_reload_msg_shown=false
mark_moves_down=true
reverse_files_only=true
auto_save_setup_panels=false
navigate_with_arrows=false
panel_scroll_pages=true
panel_scroll_center=false
mouse_move_pages=true
filetype_mode=true
permission_mode=false
torben_fj_mode=false
quick_search_mode=2
select_flags=6

[DiffView]
show_symbols=false
show_numbers=false
tab_size=8
diff_quality=0
diff_ignore_tws=false
diff_ignore_all_space=false
diff_ignore_space_change=false
diff_tab_expansion=false
diff_ignore_case=false

[Panelize]
Find *.orig after patching=find . -name \\*.orig -print
Find SUID and SGID programs=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print
Find rejects after patching=find . -name \\*.rej


Loading