Skip to content

Instantly share code, notes, and snippets.

@nakamuraos
Last active June 25, 2024 03:33
Show Gist options
  • Save nakamuraos/717eb99b5e145ed11cd754ad3714b302 to your computer and use it in GitHub Desktop.
Save nakamuraos/717eb99b5e145ed11cd754ad3714b302 to your computer and use it in GitHub Desktop.
Reset trial Navicat 15, Navicat 16, Navicat 17 on Linux
#!/bin/bash
# Author: NakamuraOS <https://github.com/nakamuraos>
# Latest update: 06/24/2024
# Tested on Navicat 15.x, 16.x, 17.x on Debian, Ubuntu.
BGRED="\e[1;97;41m"
ENDCOLOR="\e[0m"
echo -e "${BGRED} ${ENDCOLOR}"
echo -e "${BGRED} ┌──────────────────────────────────────┐ ${ENDCOLOR}"
echo -e "${BGRED} │ !!! WARNING !!! │ ${ENDCOLOR}"
echo -e "${BGRED} ├──────────────────────────────────────┤ ${ENDCOLOR}"
echo -e "${BGRED} │ ALL DATA can be destroyed. │ ${ENDCOLOR}"
echo -e "${BGRED} │ Always BACKUP before continuing. │ ${ENDCOLOR}"
echo -e "${BGRED} └──────────────────────────────────────┘ ${ENDCOLOR}"
echo -e "${BGRED} ${ENDCOLOR}"
echo -e "Report issues:\n> https://gist.github.com/nakamuraos/717eb99b5e145ed11cd754ad3714b302\n"
echo -e "Reset trial \e[1mNavicat Premium\e[0m:"
read -p "Are you sure? (y/N) " -r
echo
if [[ $REPLY =~ ^[Yy]([eE][sS])?$ ]]
then
echo "Starting reset..."
DATE=$(date '+%Y%m%d_%H%M%S')
# Backup
echo "=> Creating a backup..."
cp ~/.config/dconf/user ~/.config/dconf/user.$DATE.bk
echo "The user dconf backup was created at $HOME/.config/dconf/user.$DATE.bk"
cp ~/.config/navicat/Premium/preferences.json ~/.config/navicat/Premium/preferences.json.$DATE.bk
echo "The Navicat preferences backup was created at $HOME/.config/navicat/Premium/preferences.json.$DATE.bk"
# Clear data in dconf
echo "=> Resetting..."
dconf reset -f /com/premiumsoft/navicat-premium/
echo "The user dconf data was reset"
# Remove data fields in config file
sed -i -E 's/,?"([A-F0-9]+)":\{([^\}]+)},?//g' ~/.config/navicat/Premium/preferences.json
echo "The Navicat preferences was reset"
# Done
echo "Done."
else
echo "Aborted."
fi
@L1so
Copy link

L1so commented Apr 25, 2024

Does this script will reset settings ? So if I save connection, will this script erase it?

@nakamuraos
Copy link
Author

Does this script will reset settings ? So if I save connection, will this script erase it?

No. It'll keep all current settings, your connections will remain in place.

@Cien267
Copy link

Cien267 commented May 6, 2024

I got this error: reset-trial-navicat.sh: 23: [[: not found
Did I do something wrong?

@dotmitsu
Copy link

dotmitsu commented May 6, 2024

I got this error: reset-trial-navicat.sh: 23: [[: not found Did I do something wrong?

Run it as sudo

@Cien267
Copy link

Cien267 commented May 6, 2024

I got this error: reset-trial-navicat.sh: 23: [[: not found Did I do something wrong?

Run it as sudo

still the same error bruh :<

@dotmitsu
Copy link

dotmitsu commented May 6, 2024

still the same error bruh :<

What distro do you use?

@Cien267
Copy link

Cien267 commented May 6, 2024

What distro do you use?

I am using Ubuntu 22.04

@dotmitsu
Copy link

dotmitsu commented May 6, 2024

What distro do you use?

I am using Ubuntu 22.04

Can you show screenshot how do run command, and the result? It works good on ubuntu 22.04

@Cien267
Copy link

Cien267 commented May 6, 2024

image
that's my terminal

@dotmitsu
Copy link

dotmitsu commented May 6, 2024

@Cien267 use
sudo ./reset-trial-navicat.sh
I think this script uses bash commands in it. And sh can't normally execute

@Cien267
Copy link

Cien267 commented May 6, 2024

@dotmitsu
I try chmod +x and run "./" instead of "sh" and it works. Thank you very much <3

@swatchion
Copy link

confirm it works on 17.0

@nakamuraos
Copy link
Author

confirm it works on 17.0

It's great to hear that 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment