add chdir option

This commit is contained in:
ed 2025-08-28 20:14:25 +00:00
parent d1f75229b5
commit 14555d5832
8 changed files with 17 additions and 7 deletions

View file

@ -1134,6 +1134,7 @@ def add_general(ap, nc, srvname):
ap2.add_argument("-v", metavar="VOL", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add volume, \033[33mSRC\033[0m:\033[33mDST\033[0m:\033[33mFLAG\033[0m; examples [\033[32m.::r\033[0m], [\033[32m/mnt/nas/music:/music:r:aed\033[0m], see --help-accounts") ap2.add_argument("-v", metavar="VOL", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add volume, \033[33mSRC\033[0m:\033[33mDST\033[0m:\033[33mFLAG\033[0m; examples [\033[32m.::r\033[0m], [\033[32m/mnt/nas/music:/music:r:aed\033[0m], see --help-accounts")
ap2.add_argument("--grp", metavar="G:N,N", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add group, \033[33mNAME\033[0m:\033[33mUSER1\033[0m,\033[33mUSER2\033[0m,\033[33m...\033[0m; example [\033[32madmins:ed,foo,bar\033[0m]") ap2.add_argument("--grp", metavar="G:N,N", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add group, \033[33mNAME\033[0m:\033[33mUSER1\033[0m,\033[33mUSER2\033[0m,\033[33m...\033[0m; example [\033[32madmins:ed,foo,bar\033[0m]")
ap2.add_argument("--usernames", action="store_true", help="require username and password for login; default is just password") ap2.add_argument("--usernames", action="store_true", help="require username and password for login; default is just password")
ap2.add_argument("--chdir", metavar="PATH", type=u, help="change working-directory to \033[33mPATH\033[0m before mapping volumes")
ap2.add_argument("-ed", action="store_true", help="enable the ?dots url parameter / client option which allows clients to see dotfiles / hidden files (volflag=dots)") ap2.add_argument("-ed", action="store_true", help="enable the ?dots url parameter / client option which allows clients to see dotfiles / hidden files (volflag=dots)")
ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,xm", help="how to handle url-form POSTs; see \033[33m--help-urlform\033[0m") ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,xm", help="how to handle url-form POSTs; see \033[33m--help-urlform\033[0m")
ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="server terminal title, for example [\033[32m$ip-10.1.2.\033[0m] or [\033[32m$ip-]") ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="server terminal title, for example [\033[32m$ip-10.1.2.\033[0m] or [\033[32m$ip-]")
@ -1991,6 +1992,9 @@ def main(argv: Optional[list[str]] = None) -> None:
except: except:
sys.exit(1) sys.exit(1)
if al.chdir:
os.chdir(al.chdir)
if al.ansi: if al.ansi:
al.no_ansi = False al.no_ansi = False
elif not al.no_ansi: elif not al.no_ansi:

View file

@ -18,4 +18,4 @@ RUN ash innvikler.sh ac
WORKDIR /state WORKDIR /state
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"]

View file

@ -40,4 +40,4 @@ RUN ash innvikler.sh dj
WORKDIR /state WORKDIR /state
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"]

View file

@ -17,4 +17,4 @@ RUN ash innvikler.sh im
WORKDIR /state WORKDIR /state
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"]

View file

@ -30,4 +30,4 @@ RUN ash innvikler.sh iv
WORKDIR /state WORKDIR /state
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"]

View file

@ -15,4 +15,4 @@ RUN ash innvikler.sh min
WORKDIR /state WORKDIR /state
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "--no-thumb", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "--no-thumb", "-c", "/z/initcfg"]

View file

@ -17,7 +17,13 @@ rm -rf /var/cache/apk/* /root/.cache
# initial config; common for all flavors # initial config; common for all flavors
mkdir /state /cfg /w mkdir /state /cfg /w
chmod 777 /state /cfg /w chmod 777 /state /cfg /w
echo % /cfg > initcfg cat >initcfg <<'EOF'
[global]
chdir: /w
no-crt
% /cfg
EOF
# unpack sfx and dive in # unpack sfx and dive in
python3 copyparty-sfx.py --version python3 copyparty-sfx.py --version

View file

@ -164,7 +164,7 @@ class Cfg(Namespace):
ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs" ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs"
ka.update(**{k: 0 for k in ex.split()}) ka.update(**{k: 0 for k in ex.split()})
ex = "ah_alg bname chmod_f chpw_db doctitle df exit favico ipa html_head lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i shr tcolor textfiles txt_eol unlist vname xff_src zipmaxt R RS SR" ex = "ah_alg bname chdir chmod_f chpw_db doctitle df exit favico ipa html_head lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i shr tcolor textfiles txt_eol unlist vname xff_src zipmaxt R RS SR"
ka.update(**{k: "" for k in ex.split()}) ka.update(**{k: "" for k in ex.split()})
ex = "ban_403 ban_404 ban_422 ban_pw ban_pwc ban_url spinner" ex = "ban_403 ban_404 ban_422 ban_pw ban_pwc ban_url spinner"