Posted to tcl by aspect at Thu Feb 28 01:12:20 GMT 2019view pretty

cd "$ENV/src"                                                                                                                                                                
                                                                                                                                                                             
VFS=myproject.vfs                                                                                                                                                            
HOST=$(uname -s)                                                                                                                                                             
ARCH=$(uname -m)                                                                                                                                                             
                                                                                                                                                                             
mkdir $VFS                                                                                                                                                                   
teapot-client get $VFS $HOST $ARCH tls                                                                                                                                       
                                                                                                                                                                             
mkdir $VFS/bin                                                                                                                                                               
echo > $VFS/bin/wgetcl '#!/usr/bin/env tclkit                                                                                                                                
                                                                                                                                                                             
# magic to resolve symlink                                                                                                                                                   
lappend auto_path [file normalize [file normalize [info script]/_]/../../../lib]                                                                                             
                                                                                                                                                                             
package require http                                                                                                                                                         
package require tls                                                                                                                                                          
                                                                                                                                                                             
http::register https 443 ::tls::socket                                                                                                                                       
                                                                                                                                                                             
proc main {url} {                                                                                                                                                            
    set tok [http::geturl $url]                                                                                                                                              
    puts [http::data $tok]                                                                                                                                                   
}                                                                                                                                                                            
                                                                                                                                                                             
main {*}$::argv                                                                                                                                                              
'                                                                                                                                                                            
                                                                                                                                                                             
chmod +x $VFS/bin/wgetcl                                                                                                                                                     
                                                                                                                                                                             
ln -s $(realpath $VFS/bin/wgetcl) $ENV/bin/wgetcl                                                                                                                            
                                                                                                                                                                             
echo "Now you can run $ENV/bin/wgetcl and it will use the tls package installed in $VFS"                                                                                     
 NORMAL >> minisetup.sh[+]