File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,15 @@ usage() {
77 echo " Error: $* "
88 fi
99 cat << EOF
10- usage: $0 [update|up|down|logs] [command-specific options]
10+ usage: $0 [update|up|down|logs|deploy ] [command-specific options]
1111
1212Operate a local testnet
1313
1414 update - Update the network image from dockerhub.com
1515 up - Start the network
1616 down - Stop the network
1717 logs - Display network logging
18+ deploy - Deploy a native program.
1819
1920
2021 logs-specific options:
@@ -27,8 +28,11 @@ Operate a local testnet
2728 down-specific options:
2829 none
2930
31+ deploy-specific options:
32+ program - The program to deploy.
33+
34+ Note that deployments are discarded on network stop
3035
31- Assumes that docker is installed
3236EOF
3337 exit $exitcode
3438}
@@ -101,6 +105,24 @@ logs)
101105 docker logs solana-localnet
102106 )
103107 ;;
108+ deploy)
109+ program=$1
110+ [[ -n $program ]] || usage
111+ [[ -f $program ]] || usage " file does not exist: $program "
112+
113+ basename=$( basename " $program " )
114+ if docker exec solana-localnet test -f /usr/bin/" $basename " ; then
115+ echo " Error: $basename has already been deployed"
116+ exit 1
117+ fi
118+
119+ (
120+ set -x
121+ docker cp " $program " solana-localnet:/usr/bin/
122+ )
123+ docker exec solana-localnet ls -l /usr/bin/" $basename "
124+ echo " $basename deployed successfully"
125+ ;;
104126* )
105127 usage " Unknown command: $cmd "
106128esac
You can’t perform that action at this time.
0 commit comments