-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·114 lines (87 loc) · 2.47 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh
# -*- sh -*-
# vim: syntax=sh
# code: language=shellscript
# Copyright (c) 2024 Michael Federczuk
# SPDX-License-Identifier: MPL-2.0 AND Apache-2.0
#region preamble
case "$-" in
(*'i'*)
\command printf 'script was called interactively\n' >&2
return 124
;;
esac
set -o errexit
set -o nounset
# enabling POSIX-compliant behavior for GNU programs
export POSIXLY_CORRECT=yes POSIX_ME_HARDER=yes
if [ "${0#/}" = "$0" ]; then
argv0="$0"
else
argv0="$(basename -- "$0" && printf x)"
argv0="${argv0%"$(printf '\nx')"}"
fi
readonly argv0
#endregion
if [ $# -gt 0 ]; then
printf '%s: too many arguments: %i\n' "$argv0" $# >&2
exit 4
fi
if ! command -v localedef > '/dev/null'; then
printf '%s: localedef: program missing\n' "$argv0" >&2
exit 27
fi
uid="$(id -u)"
readonly uid
if [ "$uid" != '0' ] && [ -t 2 ]; then
printf 'The script should be executed as the root user. Continue anyway? [y/N] ' >&2
read -r ans
case "$ans" in
([yY]*)
# continue
;;
(*)
printf 'Aborted.\n' >&2
exit 48
;;
esac
unset -v ans
fi
root_dir_pathname="$(dirname -- "$0" && printf x)"
root_dir_pathname="${root_dir_pathname%"$(printf '\nx')"}"
readonly root_dir_pathname
custom_locale_defintion_filename='en_AT@custom'
readonly custom_locale_defintion_filename
custom_locale_definition_file_source_pathname="$root_dir_pathname/$custom_locale_defintion_filename"
readonly custom_locale_definition_file_source_pathname
custom_locale_definition_file_target_pathname="/usr/share/i18n/locales/$custom_locale_defintion_filename"
readonly custom_locale_definition_file_target_pathname
if [ -e "$custom_locale_definition_file_target_pathname" ]; then
if [ ! -f "$custom_locale_definition_file_target_pathname" ]; then
if [ -d "$custom_locale_definition_file_target_pathname" ]; then
what='file'
else
what='regular file'
fi
readonly what
printf '%s: %s: not a %s\n' "$argv0" "$custom_locale_definition_file_target_pathname" "$what" >&2
exit
fi
if [ -t 2 ]; then
printf 'The file %s already exists. Override it? [y/N] ' "$custom_locale_definition_file_target_pathname" >&2
read -r ans
case "$ans" in
([yY]*)
# continue
;;
(*)
printf 'Aborted.\n' >&2
exit 49
;;
esac
unset -v ans
fi
rm -- "$custom_locale_definition_file_target_pathname"
fi
cp -f -- "$custom_locale_definition_file_source_pathname" "$custom_locale_definition_file_target_pathname"
localedef -c -f UTF-8 -i "$custom_locale_definition_file_target_pathname" 'en_AT.UTF-8@custom'