12345678910111213141516171819202122232425262728293031323334 |
- #!/bin/bash
- command -v debootstrap || exit 100
- BOOTSTRAP_BIN_FILE=$(which debootstrap)
- REAL_BOOTSTRAP_BIN_FILE=$(readlink -f ${BOOTSTRAP_BIN_FILE})
- echo "BOOTSTRAP_BIN_FILE=${BOOTSTRAP_BIN_FILE}"
- echo "REAL_BOOTSTRAP_BIN_FILE=${REAL_BOOTSTRAP_BIN_FILE}"
- SCRIPT_DIR=$(dirname $(readlink -f $0))
- if [ ${BOOTSTRAP_BIN_FILE} = ${REAL_BOOTSTRAP_BIN_FILE} ]; then
- TIMESTAMP=$(date '+%Y-%m-%d')
- echo "sudo mv ${BOOTSTRAP_BIN_FILE} ${BOOTSTRAP_BIN_FILE}-${TIMESTAMP}.bak"
- sudo mv ${BOOTSTRAP_BIN_FILE} ${BOOTSTRAP_BIN_FILE}-${TIMESTAMP}.bak
- echo "sudo ln -sf ${SCRIPT_DIR}/usr/sbin/debootstrap /usr/sbin/debootstrap"
- sudo ln -sf ${SCRIPT_DIR}/usr/sbin/debootstrap /usr/sbin/debootstrap
- echo "sudo mv /usr/share/debootstrap/functions{,-${TIMESTAMP}.bak}"
- sudo mv /usr/share/debootstrap/functions{,-${TIMESTAMP}.bak}
- echo "sudo ln -sf ${SCRIPT_DIR}/usr/share/debootstrap/functions /usr/share/debootstrap/functions"
- sudo ln -sf ${SCRIPT_DIR}/usr/share/debootstrap/functions /usr/share/debootstrap/functions
- echo "sudo mv /usr/share/debootstrap/scripts/gutsy{,-${TIMESTAMP}.bak}"
- sudo mv /usr/share/debootstrap/scripts/gutsy{,-${TIMESTAMP}.bak}
- echo "sudo ln -sf ${SCRIPT_DIR}/usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/gutsy"
- sudo ln -sf ${SCRIPT_DIR}/usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/gutsy
- fi
- # 查看文件软链接情况
- ls -lh /usr/sbin/debootstrap
- ls -lh /usr/share/debootstrap/functions
- ls -lh /usr/share/debootstrap/scripts/gutsy
|