Skip to content

Commit 70c071f

Browse files
committed
[change] : Changed how to write getopt code
1 parent e2ba6ed commit 70c071f

File tree

1 file changed

+31
-127
lines changed

1 file changed

+31
-127
lines changed

build.sh

Lines changed: 31 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,36 +1058,13 @@ unset OPT OPTS OPTL DEFAULT_ARGUMENT
10581058

10591059
while true; do
10601060
case "${1}" in
1061-
-a | --arch)
1062-
arch="${2}"
1063-
shift 2
1064-
;;
1065-
-b | --boot-splash)
1066-
boot_splash=true
1067-
shift 1
1068-
;;
10691061
-c | --comp-type)
10701062
case "${2}" in
10711063
"gzip" | "lzma" | "lzo" | "lz4" | "xz" | "zstd") sfs_comp="${2}" ;;
10721064
*) msg_error "Invaild compressors '${2}'" '1' ;;
10731065
esac
10741066
shift 2
10751067
;;
1076-
-d | --debug)
1077-
debug=true
1078-
shift 1
1079-
;;
1080-
-e | --cleaning | --cleanup)
1081-
cleaning=true
1082-
shift 1
1083-
;;
1084-
-g | --gpgkey)
1085-
gpg_key="${2}"
1086-
shift 2
1087-
;;
1088-
-h | --help)
1089-
_usage 0
1090-
;;
10911068
-j | --japanese)
10921069
msg_error "This option is obsolete in AlterISO 3. To use Japanese, use \"-l ja\"." "1"
10931070
;;
@@ -1096,23 +1073,11 @@ while true; do
10961073
kernel="${2}"
10971074
shift 2
10981075
;;
1099-
-l | --lang)
1100-
locale_name="${2}"
1101-
shift 2
1102-
;;
1103-
-o | --out)
1104-
out_dir="${2}"
1105-
shift 2
1106-
;;
11071076
-p | --password)
11081077
customized_password=true
11091078
password="${2}"
11101079
shift 2
11111080
;;
1112-
-r | --tarball)
1113-
tarball=true
1114-
shift 1
1115-
;;
11161081
-t | --comp-opts)
11171082
if [[ "${2}" = "reset" ]]; then
11181083
sfs_comp_opt=()
@@ -1126,31 +1091,6 @@ while true; do
11261091
username="$(echo -n "${2}" | sed 's/ //g' | tr '[:upper:]' '[:lower:]')"
11271092
shift 2
11281093
;;
1129-
-w | --work)
1130-
work_dir="${2}"
1131-
shift 2
1132-
;;
1133-
-x | --bash-debug)
1134-
debug=true
1135-
bash_debug=true
1136-
shift 1
1137-
;;
1138-
--noconfirm)
1139-
noconfirm=true
1140-
shift 1
1141-
;;
1142-
--confirm)
1143-
noconfirm=false
1144-
shift 1
1145-
;;
1146-
--nodepend)
1147-
nodepend=true
1148-
shift 1
1149-
;;
1150-
--nocolor)
1151-
nocolor=true
1152-
shift 1
1153-
;;
11541094
--gitversion)
11551095
if [[ -d "${script_path}/.git" ]]; then
11561096
gitversion=true
@@ -1159,73 +1099,17 @@ while true; do
11591099
fi
11601100
shift 1
11611101
;;
1162-
--msgdebug)
1163-
msgdebug=true;
1164-
shift 1
1165-
;;
1166-
--noloopmod)
1167-
noloopmod=true
1168-
shift 1
1169-
;;
1170-
--noiso)
1171-
noiso=true
1172-
shift 1
1173-
;;
1174-
--noaur)
1175-
noaur=true
1176-
shift 1
1177-
;;
1178-
--nochkver)
1179-
nochkver=true
1180-
shift 1
1181-
;;
11821102
--nodebug)
11831103
debug=false
11841104
msgdebug=false
11851105
bash_debug=false
11861106
shift 1
11871107
;;
1188-
--noefi)
1189-
noefi=true
1190-
shift 1
1191-
;;
1192-
--channellist)
1193-
show_channel_list
1194-
exit 0
1195-
;;
1196-
--config)
1197-
source "${2}"
1198-
shift 2
1199-
;;
1200-
--pacman-debug)
1201-
pacman_debug=true
1202-
shift 1
1203-
;;
1204-
--nosigcheck)
1205-
nosigcheck=true
1206-
shift 1
1207-
;;
1208-
--normwork)
1209-
normwork=true
1210-
shift 1
1211-
;;
1212-
--log)
1213-
logging=true
1214-
shift 1
1215-
;;
12161108
--logpath)
12171109
logging="${2}"
12181110
customized_logpath=true
12191111
shift 2
12201112
;;
1221-
--nolog)
1222-
logging=false
1223-
shift 1
1224-
;;
1225-
--nopkgbuild)
1226-
nopkgbuild=true
1227-
shift 1
1228-
;;
12291113
--tar-type)
12301114
case "${2}" in
12311115
"gzip" | "lzma" | "lzo" | "lz4" | "xz" | "zstd") tar_comp="${2}" ;;
@@ -1242,14 +1126,37 @@ while true; do
12421126
msg_debug "Added modules: ${additional_modules[*]}"
12431127
shift 2
12441128
;;
1245-
--nogitversion)
1246-
gitversion=false
1247-
shift 1
1248-
;;
1249-
--)
1250-
shift
1251-
break
1252-
;;
1129+
-g | --gpgkey ) gpg_key="${2}" && shift 2 ;;
1130+
-h | --help ) _usage 0 ;;
1131+
-a | --arch ) arch="${2}" && shift 2 ;;
1132+
-d | --debug ) debug=true && shift 1 ;;
1133+
-e | --cleaning | --cleanup ) cleaning=true && shift 1 ;;
1134+
-b | --boot-splash ) boot_splash=true && shift 1 ;;
1135+
-l | --lang ) locale_name="${2}" && shift 2 ;;
1136+
-o | --out ) out_dir="${2}" && shift 2 ;;
1137+
-r | --tarball ) tarball=true && shift 1 ;;
1138+
-w | --work ) work_dir="${2}" && shift 2 ;;
1139+
-x | --bash-debug ) bash_debug=true && shift 1 ;;
1140+
--noconfirm ) noconfirm=true && shift 1 ;;
1141+
--confirm ) noconfirm=false && shift 1 ;;
1142+
--nodepend ) nodepend=true && shift 1 ;;
1143+
--nocolor ) nocolor=true && shift 1 ;;
1144+
--msgdebug ) msgdebug=true && shift 1 ;;
1145+
--noloopmod ) noloopmod=true && shift 1 ;;
1146+
--noiso ) noiso=true && shift 1 ;;
1147+
--noaur ) noaur=true && shift 1 ;;
1148+
--nochkver ) nochkver=true && shift 1 ;;
1149+
--noefi ) noefi=true && shift 1 ;;
1150+
--channellist ) show_channel_list && exit 0 ;;
1151+
--config ) source "${2}" && shift 2 ;;
1152+
--pacman-debug ) pacman_debug=true && shift 1 ;;
1153+
--nosigcheck ) nosigcheck=true && shift 1 ;;
1154+
--normwork ) normwork=true && shift 1 ;;
1155+
--log ) logging=true && shift 1 ;;
1156+
--nolog ) logging=false && shift 1 ;;
1157+
--nopkgbuild ) nopkgbuild=true && shift 1 ;;
1158+
--nogitversion ) gitversion=false && shift 1 ;;
1159+
-- ) shift 1 && break ;;
12531160
*)
12541161
msg_error "Argument exception error '${1}'"
12551162
msg_error "Please report this error to the developer." 1
@@ -1301,7 +1208,6 @@ for _dir in build_dir cache_dir airootfs_dir isofs_dir lockfile_dir out_dir; do
13011208
eval "${_dir}=\"$(realpath "$(eval "echo \$${_dir}")")\""
13021209
done
13031210

1304-
13051211
# Set for special channels
13061212
if [[ -d "${channel_dir}.add" ]]; then
13071213
channel_name="${1}"
@@ -1322,8 +1228,6 @@ if [[ ! "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" ver "$
13221228
fi
13231229
fi
13241230

1325-
set -eu
1326-
13271231
prepare_env
13281232
prepare_build
13291233
show_settings

0 commit comments

Comments
 (0)