update the sym link logic
@@ -48,14 +48,16 @@ var cleanupCmd = &cobra.Command{
const (
FRONTENDCLEANUP_COMMANDS = `
sudo systemctl stop chef-automate;
- sudo rm -rf /hab;
+ [ ! -L /hab ] && [ -d /hab ] && echo "not a symbolic, but it is directory...so deleting /hab" && sudo rm -rf /hab;
+ [ -L /hab ] && echo "/hab is the symbolic link, so deleting the content of symbolic link" && sudo rm -rf /hab/*
sudo rm -rf /var/automate-ha;
`
BACKENDCLEANUP_COMMANDS = `
sudo systemctl stop hab-sup;
- sudo rm -rf /hab;
- sudo rm -rf /bin/hab;
+ [ ! -L /hab ] && [ -d /hab ] && echo "not a symbolic, but it is directory...so deleting /hab" && sudo rm -rf /hab;
+ [ -L /hab ] && echo "/hab is the symbolic link, so deleting the content of symbolic link" && sudo rm -rf /hab/*
+ [ -f /bin/hab ] && sudo rm -rf /bin/hab;
sudo rm -rf /var/automate-ha;
`
)
