Index: scripts/factory_reset.sh =================================================================== diff -u -r171d48df58e510ae24a2abed14c52af564b375ee -r7d194844bb325200b78da21ae7457bb7f7543ec7 --- scripts/factory_reset.sh (.../factory_reset.sh) (revision 171d48df58e510ae24a2abed14c52af564b375ee) +++ scripts/factory_reset.sh (.../factory_reset.sh) (revision 7d194844bb325200b78da21ae7457bb7f7543ec7) @@ -45,7 +45,6 @@ DEFAULT_BRIGHTNESS_LEVEL=10 - TRUE=1 FALSE=0 function false() { echo $FALSE; } @@ -64,50 +63,6 @@ echo $_ok_ } -# checks if the passed argument is a number -function isNumber () - # $1 - mutant: the argument to be detected -{ - local _ok_=$FALSE - if [[ $1 =~ ^[0-9]+$ ]]; then - _ok_=$TRUE - fi - echo $_ok_ -} - -# checks if the passed argument is a directory -function isDirectory() - # $1 - string: the argument to be detected -{ - local _ok_=$FALSE - if [[ -d $1 ]]; then - _ok_=$TRUE - fi - echo $_ok_ -} - -# checks if the passed argument is a file -function isFile() - # $1 - string: the argument to be detected -{ - local _ok_=$FALSE - if [[ -f $1 ]]; then - _ok_=$TRUE - fi - echo $_ok_ -} - -# checks if the passed argument exists -function exists() - # $1 - string: the argument to be detected -{ - local _ok_=$FALSE - if [[ -e $1 ]]; then - _ok_=$TRUE - fi - echo $_ok_ -} - # exits with the exit code if the condition ($1) is non-zero function exitError () # $1 - number: boolean result to exit if non-zero, with exit code @@ -123,47 +78,14 @@ fi } -# removes all the files in the directory and sub-directory in a recursive manner -function clearFolderContent() - # $1 - Directory path - # $2 - Directory alias name -{ - local _has_error_=$[ ! $(isDirectory $1)] - exitError $_has_error_ $ERR_REMOVE_PRM_DIR "'$1' is not a directory" - - rm -rf "$1/*/*" - _has_error_=$? - exitError $_has_error_ $ERR_REMOVE_CMD_DIR "Failed $2 folder deletion" - - list=("$1"/*) - fileCount=${#list[@]} - _has_error_=$fileCount - exitError $_has_error_ $ERR_REMOVE_DEL_DIR "Remained '$fileCount' file(s) undeleted" -} - -# exits rm command fails or if file was not removed -function removeSingleFile() - # $1 - path to file - # $2 - file alias name -{ - local _has_error_=$[ ! $(isFile $1)] - exitError $_has_error_ $ERR_REMOVE_PRM_FIL "'$1' is not a file" - - rm -f "$1" - _has_error_=$? - exitError $_has_error_ $ERR_REMOVE_CMD_FIL "Failed $2 file deletion" - - _has_error_=$(exists $1) - exitError $_has_error_ $ERR_REMOVE_DEL_FIL "Remained $2 file undeleted" -} - function deleteWiFi() { - SCRIPTS=/home/$(whoami)/scripts + SCRIPTS=/home/$(whoami)/ + # $SCRIPTS/wifi_disconnect.sh $SCRIPTS/wifi_disconnect_network.sh wlan0 } function deleteBluetooth() { - SCRIPTS=/home/$(whoami)/scripts + SCRIPTS=/home/$(whoami) $SCRIPTS/bluetooth_paired_clear.sh }