Exit menu now does cleanup automatically with verification
Changes: - Cleans ~/.bash_history file immediately when user selects yes - Verifies curl command is gone from file before continuing - Removes logs, temp files, toolkit directory automatically - Shows verification: "✓ Verified: No curl download commands in history file" - User just needs to run: history -c, unset HISTFILE, exit No more asking user to source scripts. Just do the cleanup and verify.
This commit is contained in:
+39
-3
@@ -1507,12 +1507,48 @@ main() {
|
|||||||
read -p "Clean history and remove traces? (yes/no): " clean_hist
|
read -p "Clean history and remove traces? (yes/no): " clean_hist
|
||||||
|
|
||||||
if [ "$clean_hist" = "yes" ]; then
|
if [ "$clean_hist" = "yes" ]; then
|
||||||
|
# Clean history in .bash_history file
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}After launcher exits, run:${NC}"
|
echo "→ Cleaning bash history..."
|
||||||
|
GREP_PATTERN="git\.mull\.lol|linux-server-management-toolkit|server-toolkit|launcher\.sh|erase-toolkit-traces"
|
||||||
|
|
||||||
|
if [ -f ~/.bash_history ]; then
|
||||||
|
cp ~/.bash_history ~/.bash_history.bak.$$
|
||||||
|
grep -Ev "$GREP_PATTERN" ~/.bash_history.bak.$$ > ~/.bash_history 2>/dev/null || true
|
||||||
|
rm -f ~/.bash_history.bak.$$
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify curl command is gone from file
|
||||||
|
if grep -q "git\.mull\.lol.*toolkit" ~/.bash_history 2>/dev/null; then
|
||||||
|
echo -e "${RED}✗ Warning: curl command still in history file${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}✓ Verified: No curl download commands in history file${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove logs and temp files
|
||||||
|
echo "→ Removing logs and temp files..."
|
||||||
|
rm -f "$BASE_DIR/logs/"*.log 2>/dev/null
|
||||||
|
rm -f "$BASE_DIR/"*_report_*.txt 2>/dev/null
|
||||||
|
rm -rf /tmp/live-monitor-* /tmp/server-toolkit-* 2>/dev/null
|
||||||
|
|
||||||
|
# Remove toolkit directory
|
||||||
|
echo "→ Removing toolkit directory..."
|
||||||
|
cd /root 2>/dev/null
|
||||||
|
TOOLKIT_DIR="$BASE_DIR"
|
||||||
|
rm -rf "$TOOLKIT_DIR" 2>/dev/null
|
||||||
|
|
||||||
|
clear
|
||||||
echo ""
|
echo ""
|
||||||
echo "TRACE_ERASER_AUTO=yes source $BASE_DIR/tools/erase-toolkit-traces.sh"
|
echo -e "${GREEN}✓ All traces removed from files${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}This will clean history in your current shell and remove all traces.${NC}"
|
echo -e "${YELLOW}IMPORTANT: Your current shell still has history in memory.${NC}"
|
||||||
|
echo -e "${YELLOW}Run these commands to finish:${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "history -c"
|
||||||
|
echo "unset HISTFILE"
|
||||||
|
echo "exit"
|
||||||
|
echo ""
|
||||||
|
echo "Then start a new shell."
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user