kopia lustrzana https://github.com/OpenDroneMap/WebODM
Added resetadminpassword command, better stop/teardown commands
rodzic
f08517bab9
commit
d7a37236c7
31
webodm.sh
31
webodm.sh
|
@ -24,9 +24,11 @@ usage(){
|
|||
echo "Command list:"
|
||||
echo " start Start WebODM"
|
||||
echo " stop Stop WebODM"
|
||||
echo " down Stop and remove WebODM's docker containers"
|
||||
echo " update Update WebODM to the latest release"
|
||||
echo " rebuild Rebuild all docker containers and perform cleanups"
|
||||
echo " checkenv Do an environment check and install missing components"
|
||||
echo " resetadminpassword <newpassword> Reset the administrator's password to a new one. WebODM must be running when executing this command."
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -83,6 +85,27 @@ rebuild(){
|
|||
echo -e "\033[1mDone!\033[0m You can now start WebODM by running $0 start"
|
||||
}
|
||||
|
||||
resetpassword(){
|
||||
newpass=$1
|
||||
|
||||
if [[ ! -z "$newpass" ]]; then
|
||||
container_hash=$(docker ps -q --filter "name=webapp")
|
||||
if [[ -z "$container_hash" ]]; then
|
||||
echo -e "\033[91mCannot find webapp docker container. Is WebODM running?\033[39m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker exec -ti $container_hash bash -c "echo \"from django.contrib.auth.models import User;from django.contrib.auth.hashers import make_password;u=User.objects.filter(is_superuser=True)[0];u.password=make_password('$newpass');u.save();print('The following user was changed: {}'.format(u.username));\" | python manage.py shell"
|
||||
if [[ "$?" -eq 0 ]]; then
|
||||
echo -e "\033[1mPassword changed!\033[0m"
|
||||
else
|
||||
echo -e "\033[91mCould not change administrator password. If you need help, please visit https://github.com/OpenDroneMap/WebODM/issues/ \033[39m"
|
||||
fi
|
||||
else
|
||||
usage
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $1 = "start" ]]; then
|
||||
environment_check
|
||||
echo "Starting WebODM..."
|
||||
|
@ -90,7 +113,11 @@ if [[ $1 = "start" ]]; then
|
|||
elif [[ $1 = "stop" ]]; then
|
||||
environment_check
|
||||
echo "Stopping WebODM..."
|
||||
run "docker-compose stop"
|
||||
run "docker-compose -f docker-compose.yml -f docker-compose.nodeodm.yml stop"
|
||||
elif [[ $1 = "down" ]]; then
|
||||
environment_check
|
||||
echo "Tearing down WebODM..."
|
||||
run "docker-compose -f docker-compose.yml -f docker-compose.nodeodm.yml down"
|
||||
elif [[ $1 = "rebuild" ]]; then
|
||||
environment_check
|
||||
echo "Rebuilding WebODM..."
|
||||
|
@ -105,6 +132,8 @@ elif [[ $1 = "update" ]]; then
|
|||
echo -e "\033[1mDone!\033[0m You can now start WebODM by running $0 start"
|
||||
elif [[ $1 = "checkenv" ]]; then
|
||||
environment_check
|
||||
elif [[ $1 = "resetadminpassword" ]]; then
|
||||
resetpassword $2
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
|
Ładowanie…
Reference in New Issue