48 lines
1.2 KiB
Bash
Executable file
48 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
: \
|
|
&& me="$(readlink -f "$0")" \
|
|
&& cd "${me%/*}" \
|
|
\
|
|
&& have() \
|
|
{ : \
|
|
&& if [ -z "$ZSH_VERSION" ] \
|
|
;then : \
|
|
&& which -- "$1" \
|
|
;else : \
|
|
&& whence -p -- "$1" \
|
|
;fi \
|
|
;} 2>/dev/null \
|
|
\
|
|
&& { [ -d out ] || mkdir out ;} \
|
|
&& out="$(realpath out)" \
|
|
&& { :\
|
|
&& super="$(have sudo)" \
|
|
|| super="$(have doas)" \
|
|
;} \
|
|
&& cd /opt \
|
|
&& { [ -w . ] || "$super" chown root:wheel . ;} \
|
|
&& { [ -w . ] || "$super" chmod 0775 . ;} \
|
|
&& now="$(date -u +%s)" \
|
|
&& podman run -v="$out":/out --rm localhost/cosmo \
|
|
tar zcf "/out/cosmopolitan-$now.tar.gz" /cosmopolitan \
|
|
&& if [ -L cosmopolitan ] \
|
|
;then : \
|
|
&& rm cosmopolitan \
|
|
;elif [ -d cosmopolitan ] \
|
|
;then : \
|
|
&& timestamp="$(date -u -r cosmopolitan +%s)" \
|
|
&& mv cosmopolitan "cosmopolitan-$timestamp" \
|
|
;fi \
|
|
&& cd /opt \
|
|
&& tar zxf "$out/cosmopolitan-$now.tar.gz" \
|
|
&& mv cosmopolitan "cosmopolitan-$now" \
|
|
&& ln -s "cosmopolitan-$now" cosmopolitan \
|
|
&& cd cosmopolitan \
|
|
&& tar zxf dist/headers.tar.gz \
|
|
&& du -hd0 /opt/cosmopolitan/ \
|
|
&& . ./env \
|
|
&& COSMO=/opt/cosmopolitan \
|
|
&& COSMO_DIST="/opt/cosmopolitan/dist/$flavor" \
|
|
&& `#ADDPATH /opt/cosmopolitan/gcc/bin` \
|
|
;
|