From 7ada754cb207ef125bfd622fddde4b800f09a611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin?= Date: Sat, 1 Jun 2024 12:09:21 +0200 Subject: [PATCH] feat: import current gist From here https://gist.github.com/tuxity/32b353f00b38fe41c64434b98fdee077 --- reset-trial.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 reset-trial.sh diff --git a/reset-trial.sh b/reset-trial.sh new file mode 100644 index 0000000..e22be07 --- /dev/null +++ b/reset-trial.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -e + +file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist) + +regex="CFBundleShortVersionString = \"([^\.]+)" +[[ $file =~ $regex ]] + +version=${BASH_REMATCH[1]} + +echo "Detected Navicat Premium version $version" + +case $version in + "17"|"16") + file=~/Library/Preferences/com.navicat.NavicatPremium.plist + ;; + "15") + file=~/Library/Preferences/com.prect.NavicatPremium15.plist + ;; + *) + echo "Version '$version' not handled" + exit 1 + ;; +esac + +echo "Reseting trial time..." + +regex="([0-9A-Z]{32}) = " +[[ $(defaults read $file) =~ $regex ]] + +hash=${BASH_REMATCH[1]} + +if [ ! -z $hash ]; then + echo "deleting $hash array..." + defaults delete $file $hash +fi + +regex="\.([0-9A-Z]{32})" +[[ $(ls -a ~/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/ | grep '^\.') =~ $regex ]] + +hash2=${BASH_REMATCH[1]} + +if [ ! -z $hash2 ]; then + echo "deleting $hash2 folder..." + rm ~/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/.$hash2 +fi + +echo "Done"