Add subcmd resetfirstrun

This commit is contained in:
clsty
2025-11-12 21:25:25 +08:00
parent 318d80de38
commit 9997fdce0c
6 changed files with 38 additions and 3 deletions
+1 -1
View File
@@ -26,4 +26,4 @@ STY_RST='\e[00m'
# Used by register_temp_file()
declare -a TEMP_FILES_TO_CLEANUP=()
FIRSTRUN_FILE="${XDG_CACHE_HOME}/.ii-qs-installed"
+2
View File
@@ -344,6 +344,7 @@ function backup_clashing_targets(){
x mkdir -p $backup_dir
x rsync -av --progress "${args_includes[@]}" "$target_dir/" "$backup_dir/"
}
function install_cmds(){
case $OS_GROUP_ID in
"arch")
@@ -401,6 +402,7 @@ function install_cmds(){
;;
esac
}
function ensure_cmds(){
local not_found_cmds=()
for cmd in "$@"; do
-1
View File
@@ -35,7 +35,6 @@ function copy_dir_s_t(){
#####################################################################################
# In case some dirs does not exists
v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME/icons
firstrun_file="${XDG_CACHE_HOME}/.ii-qs-installed"
if test -f "${firstrun_file}"; then
firstrun=false
else
+6
View File
@@ -0,0 +1,6 @@
# This script is meant to be sourced.
# It's not for directly running.
# shellcheck shell=bash
try rm "${FIRSTRUN_FILE}"
+27
View File
@@ -0,0 +1,27 @@
# Handle args for subcmd: checkdeps
# shellcheck shell=bash
showhelp(){
echo -e "Syntax: $0 resetfirstrun [OPTIONS]
Reset firstrun state.
Options:
-h, --help Show this help message and exit
"
}
# `man getopt` to see more
para=$(getopt \
-o c \
-l help \
-n "$0" -- "$@")
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
#####################################################################################
eval set -- "$para"
while true ; do
case "$1" in
-h|--help) showhelp;exit;;
--) shift;break ;;
*) sleep 0 ;;
esac
done