#!/bin/bash

if [[ ! -f /root/wdd/lib/wdd-lib-log.sh ]]; then
    wget https://oss-s1.107421.xyz/wdd-lib-log.sh -O /root/wdd/lib/wdd-lib-log.sh
fi
source /root/wdd/lib/wdd-lib-log.sh

clean_oracle_agent() {

  FunctionStart
  colorEchoBlue "准备清理 Oracle Agent的相关内容 ！"
  snap info oracle-cloud-agent
  snap stop oracle-cloud-agent
  snap remove oracle-cloud-agent


  for i in $(ls /lib/systemd/system/ | grep snapd | awk '{print$1}'); do
    echo $i
    systemctl stop $i
    systemctl disable $i
  done

  local loop
  for loop in $(df -h | grep snap | awk '{print$1}');do
     echo "unmount $loop"
     umount "$loop"
  done

  rm -rf /root/snap
  rm -rf /var/snap
  rm -rf /usr/bin/snap
  rm -rf /snap/
  rm -rf /var/lib/snapd

  FunctionSuccess
  FunctionEnd
}

clean_ip_persist() {
  FunctionStart
  colorEchoBlue "开始关闭 防火墙持久化存储 …………"
  systemctl stop systemd-resolved.service && systemctl disable systemd-resolved.service
  systemctl stop netfilter-persistent.service && systemctl disable netfilter-persistent.service
  FunctionEnd
  FunctionSuccess
}
