add install-cosmo script
This commit is contained in:
parent
5558b84ea9
commit
3db9f0eff9
48
install-cosmo
Executable file
48
install-cosmo
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/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` \
|
||||
;
|
Loading…
Reference in New Issue
Block a user