home · contact · privacy
Fix if conditions.
[config] / bookworm / setup_scripts / misc.sh
1 #!/bin/sh
2 set -e
3 debian_version="bookworm"
4 legal_system_names="x220 w530"
5 config_tree_prefix="${HOME}/public_repos/config/${debian_version}"
6 if [ ! -d "${config_tree_prefix}" ]; then
7     config_tree_prefix="${HOME}/config/${debian_version}"
8 fi
9 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
10 aptmark_dir="${config_tree_prefix}/apt-mark"
11
12 expect_n_args() {
13     min_args="$1"
14     explainer="$2"
15     shift 2
16     if [ "$#" -lt "${min_args}" ]; then
17         echo "Need at least ${1} arguments … ${explainer}"
18         false
19     fi
20 }
21
22 expect_setup_finished_file() {
23     filename="$1"
24     setup_script="$2"
25     if [ ! -f "${HOME}/${filename}" ]; then
26         echo "First need to run ${setup_script}."
27         false
28     fi
29 }
30
31 get_system_name_arg() {
32     found=0
33     for system_name_i in $legal_system_names; do
34         if [ "$1" = "$system_name_i" ]; then
35             found=1
36             system_name="${system_name_i}"
37             continue    
38         fi
39     done
40     if [ "$found" = 0 ]; then
41         echo "Need legal system name."
42         false
43     fi
44 }