Add code
This commit is contained in:
parent
fde9a8e288
commit
bb202db8d7
32
makerelease.sh
Executable file
32
makerelease.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -r VERSION=${1}
|
||||
declare -r MESSAGE=${2}
|
||||
declare -r TAGBRANCH=main
|
||||
declare CURRENTBRANCH=""
|
||||
|
||||
showHelp() {
|
||||
echo makerelease version
|
||||
}
|
||||
|
||||
if [ "${VERSION}" == "" ]; then
|
||||
showHelp
|
||||
echo ""
|
||||
echo "no version provided!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURRENTBRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
if [ ! "${CURRENTBRANCH}" == "dev" ]; then
|
||||
echo "You are not in dev branch!"
|
||||
echo "Use dev branch to make a release!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git checkout "${TAGBRANCH}"
|
||||
git merge "${CURRENTBRANCH}"
|
||||
git push
|
||||
git tag -a "${VERSION}" -m "${MESSAGE}"
|
||||
git push --tags
|
||||
git checkout "${CURRENTBRANCH}"
|
82
mtm-ddwipe
Executable file
82
mtm-ddwipe
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -r DEV="${1}"
|
||||
|
||||
show_help() {
|
||||
echo "ddwipe dev (/dev/sdX)"
|
||||
echo ""
|
||||
echo "Version : 0.0.3"
|
||||
}
|
||||
|
||||
check_args() {
|
||||
if [ "${1}" == "" ]; then
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_dev_exist() {
|
||||
if [ ! -e "${1}" ]; then
|
||||
echo "${1} is missing."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
confirm_wipe() {
|
||||
lsblk "${1}"
|
||||
echo ""
|
||||
read -r -p "Wipe ${1} (y/[n])?" CHOICE
|
||||
case "${CHOICE}" in
|
||||
y|Y ) echo "";;
|
||||
* )
|
||||
echo "Canceled"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
wipe_dev() {
|
||||
echo "Begin wiping device ${1}"
|
||||
echo ""
|
||||
echo "Start date :"
|
||||
date
|
||||
echo ""
|
||||
echo "blkdiscard secure"
|
||||
if ! blkdiscard -f -p 1G -s "${1}"; then
|
||||
echo ""
|
||||
echo "blkdiscard zero"
|
||||
if ! blkdiscard -f -p 1G -z "${1}"; then
|
||||
echo ""
|
||||
echo "dd zero"
|
||||
if ! dd if=/dev/zero of="${1}" bs=1M status=progress; then
|
||||
# Need check if dd has all writed, if yes, return no error
|
||||
# echo "Error wiping device ${1}, use phisical destroy !"
|
||||
echo "Wiped with dd, check if full size is writed."
|
||||
echo "Otherwise use a mechanical destruction of the device."
|
||||
print_time
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
echo "Device ${1} wipped !"
|
||||
}
|
||||
|
||||
print_time() {
|
||||
ENDDATE=$(date +%s)
|
||||
echo ""
|
||||
echo "End date :"
|
||||
date
|
||||
|
||||
CALCTIME=$((ENDDATE-STARTDATE))
|
||||
echo ""
|
||||
echo "Total time :"
|
||||
date -d@${CALCTIME} -u +%H:%M:%S
|
||||
}
|
||||
|
||||
check_args "${DEV}"
|
||||
check_dev_exist "${DEV}"
|
||||
confirm_wipe "${DEV}"
|
||||
STARTDATE=$(date +%s)
|
||||
wipe_dev "${DEV}"
|
||||
print_time
|
Loading…
Reference in New Issue
Block a user