diff --git a/sdata/lib/environment-variables.sh b/sdata/lib/environment-variables.sh index 71ca6d023..5344be4c7 100644 --- a/sdata/lib/environment-variables.sh +++ b/sdata/lib/environment-variables.sh @@ -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" diff --git a/sdata/lib/functions.sh b/sdata/lib/functions.sh index 96ddb7eb4..54d4c3b73 100644 --- a/sdata/lib/functions.sh +++ b/sdata/lib/functions.sh @@ -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 diff --git a/sdata/subcmd-install/3.files-legacy.sh b/sdata/subcmd-install/3.files-legacy.sh index c4a755728..aab67d03c 100644 --- a/sdata/subcmd-install/3.files-legacy.sh +++ b/sdata/subcmd-install/3.files-legacy.sh @@ -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 diff --git a/sdata/subcmd-resetfirstrun/0.run.sh b/sdata/subcmd-resetfirstrun/0.run.sh new file mode 100644 index 000000000..b81f642f4 --- /dev/null +++ b/sdata/subcmd-resetfirstrun/0.run.sh @@ -0,0 +1,6 @@ +# This script is meant to be sourced. +# It's not for directly running. + +# shellcheck shell=bash + +try rm "${FIRSTRUN_FILE}" diff --git a/sdata/subcmd-resetfirstrun/options.sh b/sdata/subcmd-resetfirstrun/options.sh new file mode 100644 index 000000000..e5def7d2b --- /dev/null +++ b/sdata/subcmd-resetfirstrun/options.sh @@ -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 diff --git a/setup b/setup index 81cb11675..47c343599 100755 --- a/setup +++ b/setup @@ -33,6 +33,7 @@ Subcommands: exp-update (Experimental) Update illogical-impulse without fully reinstall. exp-update-old (Experimental) exp-update but use behaves like old version. + resetfirstrun Reset firstrun state. checkdeps (For dev only) Check whether pkgs exist in AUR or repos of Arch. virtmon (For dev only) Create virtual monitors for testing multi-monitors. help Show this help message. @@ -47,7 +48,7 @@ case $1 in # Global help ""|help|--help|-h)showhelp_global;exit;; # Correct subcommand - install|exp-uninstall|exp-update|exp-update-old|checkdeps|virtmon) + install|exp-uninstall|exp-update|exp-update-old|resetfirstrun|checkdeps|virtmon) SUBCMD_NAME=$1 SUBCMD_DIR=./sdata/subcmd-$1 shift;;