Skip to content

Commit a668f9f

Browse files
committed
Sync with microG unofficial installer
1 parent e75b82b commit a668f9f

File tree

2 files changed

+136
-134
lines changed

2 files changed

+136
-134
lines changed

zip-content/customize.sh

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ export KEYCHECK_ENABLED='false'
126126

127127
### FUNCTIONS ###
128128

129-
ui_debug()
130-
{
131-
printf '%s\n' "${1?}"
132-
}
133-
134129
_send_text_to_recovery()
135130
{
136131
if test "${RECOVERY_OUTPUT:?}" != 'true'; then return; fi # Nothing to do here
@@ -144,6 +139,43 @@ _send_text_to_recovery()
144139
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1?}"; fi
145140
}
146141

142+
ui_error()
143+
{
144+
ERROR_CODE=79
145+
if test -n "${2:-}"; then ERROR_CODE="${2:?}"; fi
146+
147+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
148+
_send_text_to_recovery "ERROR ${ERROR_CODE:?}: ${1:?}"
149+
else
150+
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR ${ERROR_CODE:?}: ${1:?}"
151+
fi
152+
153+
abort '' 2> /dev/null || exit "${ERROR_CODE:?}"
154+
}
155+
156+
ui_warning()
157+
{
158+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
159+
_send_text_to_recovery "WARNING: ${1:?}"
160+
else
161+
printf 1>&2 '\033[0;33m%s\033[0m\n' "WARNING: ${1:?}"
162+
fi
163+
}
164+
165+
ui_msg()
166+
{
167+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
168+
_send_text_to_recovery "${1:?}"
169+
else
170+
printf '%s\n' "${1:?}"
171+
fi
172+
}
173+
174+
ui_debug()
175+
{
176+
printf '%s\n' "${1?}"
177+
}
178+
147179
enable_debug_log()
148180
{
149181
if test "${DEBUG_LOG_ENABLED}" -eq 1; then return; fi
@@ -187,38 +219,6 @@ disable_debug_log()
187219
fi
188220
}
189221

190-
ui_error()
191-
{
192-
ERROR_CODE=79
193-
if test -n "${2:-}"; then ERROR_CODE="${2:?}"; fi
194-
195-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
196-
_send_text_to_recovery "ERROR ${ERROR_CODE:?}: ${1:?}"
197-
else
198-
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR ${ERROR_CODE:?}: ${1:?}"
199-
fi
200-
201-
abort '' 2> /dev/null || exit "${ERROR_CODE:?}"
202-
}
203-
204-
ui_warning()
205-
{
206-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
207-
_send_text_to_recovery "WARNING: ${1:?}"
208-
else
209-
printf 1>&2 '\033[0;33m%s\033[0m\n' "WARNING: ${1:?}"
210-
fi
211-
}
212-
213-
ui_msg()
214-
{
215-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
216-
_send_text_to_recovery "${1:?}"
217-
else
218-
printf '%s\n' "${1:?}"
219-
fi
220-
}
221-
222222
set_perm()
223223
{
224224
local uid="$1"

zip-content/inc/common-functions.sh

Lines changed: 99 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,105 @@ readonly NL='
4646

4747
### FUNCTIONS ###
4848

49+
# Message related functions
50+
_send_text_to_recovery()
51+
{
52+
if test "${RECOVERY_OUTPUT:?}" != 'true'; then return; fi # Nothing to do here
53+
54+
if test -e "${RECOVERY_PIPE:?}"; then
55+
printf 'ui_print %s\nui_print\n' "${1?}" >> "${RECOVERY_PIPE:?}"
56+
else
57+
printf 'ui_print %s\nui_print\n' "${1?}" 1>&"${OUTFD:?}"
58+
fi
59+
60+
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1?}"; fi
61+
}
62+
63+
ui_error()
64+
{
65+
ERROR_CODE=91
66+
if test -n "${2:-}"; then ERROR_CODE="${2:?}"; fi
67+
68+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
69+
_send_text_to_recovery "ERROR ${ERROR_CODE:?}: ${1:?}"
70+
else
71+
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR ${ERROR_CODE:?}: ${1:?}"
72+
fi
73+
74+
exit "${ERROR_CODE:?}"
75+
}
76+
77+
ui_recovered_error()
78+
{
79+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
80+
_send_text_to_recovery "RECOVERED ERROR: ${1:?}"
81+
else
82+
printf 1>&2 '\033[1;31;103m%s\033[0m\n' "RECOVERED ERROR: ${1:?}"
83+
fi
84+
}
85+
86+
ui_warning()
87+
{
88+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
89+
_send_text_to_recovery "WARNING: ${1:?}"
90+
else
91+
printf 1>&2 '\033[0;33m%s\033[0m\n' "WARNING: ${1:?}"
92+
fi
93+
}
94+
95+
ui_msg_empty_line()
96+
{
97+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
98+
_send_text_to_recovery ' '
99+
else
100+
printf '\n'
101+
fi
102+
}
103+
104+
ui_msg()
105+
{
106+
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
107+
_send_text_to_recovery "${1:?}"
108+
else
109+
printf '%s\n' "${1:?}"
110+
fi
111+
}
112+
113+
ui_msg_sameline_start()
114+
{
115+
if test "${RECOVERY_OUTPUT:?}" = 'false'; then
116+
printf '%s ' "${1:?}"
117+
return
118+
elif test -e "${RECOVERY_PIPE:?}"; then
119+
printf 'ui_print %s' "${1:?}" >> "${RECOVERY_PIPE:?}"
120+
else
121+
printf 'ui_print %s' "${1:?}" 1>&"${OUTFD:?}"
122+
fi
123+
124+
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1:?}"; fi
125+
}
126+
127+
ui_msg_sameline_end()
128+
{
129+
if test "${RECOVERY_OUTPUT:?}" = 'false'; then
130+
printf '%s\n' "${1:?}"
131+
return
132+
elif test -e "${RECOVERY_PIPE:?}"; then
133+
printf '%s\nui_print\n' "${1:?}" >> "${RECOVERY_PIPE:?}"
134+
else
135+
printf '%s\nui_print\n' "${1:?}" 1>&"${OUTFD:?}"
136+
fi
137+
138+
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1:?}"; fi
139+
}
140+
141+
ui_debug()
142+
{
143+
printf 1>&2 '%s\n' "${1?}"
144+
}
145+
146+
# Other
147+
49148
_canonicalize()
50149
{
51150
if test ! -e "${1:?}"; then
@@ -1507,103 +1606,6 @@ finalize_and_report_success()
15071606
fi
15081607
}
15091608

1510-
# Message related functions
1511-
_send_text_to_recovery()
1512-
{
1513-
if test "${RECOVERY_OUTPUT:?}" != 'true'; then return; fi # Nothing to do here
1514-
1515-
if test -e "${RECOVERY_PIPE:?}"; then
1516-
printf 'ui_print %s\nui_print\n' "${1?}" >> "${RECOVERY_PIPE:?}"
1517-
else
1518-
printf 'ui_print %s\nui_print\n' "${1?}" 1>&"${OUTFD:?}"
1519-
fi
1520-
1521-
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1?}"; fi
1522-
}
1523-
1524-
ui_error()
1525-
{
1526-
ERROR_CODE=91
1527-
if test -n "${2:-}"; then ERROR_CODE="${2:?}"; fi
1528-
1529-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
1530-
_send_text_to_recovery "ERROR ${ERROR_CODE:?}: ${1:?}"
1531-
else
1532-
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR ${ERROR_CODE:?}: ${1:?}"
1533-
fi
1534-
1535-
exit "${ERROR_CODE:?}"
1536-
}
1537-
1538-
ui_recovered_error()
1539-
{
1540-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
1541-
_send_text_to_recovery "RECOVERED ERROR: ${1:?}"
1542-
else
1543-
printf 1>&2 '\033[1;31;103m%s\033[0m\n' "RECOVERED ERROR: ${1:?}"
1544-
fi
1545-
}
1546-
1547-
ui_warning()
1548-
{
1549-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
1550-
_send_text_to_recovery "WARNING: ${1:?}"
1551-
else
1552-
printf 1>&2 '\033[0;33m%s\033[0m\n' "WARNING: ${1:?}"
1553-
fi
1554-
}
1555-
1556-
ui_msg_empty_line()
1557-
{
1558-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
1559-
_send_text_to_recovery ' '
1560-
else
1561-
printf '\n'
1562-
fi
1563-
}
1564-
1565-
ui_msg()
1566-
{
1567-
if test "${RECOVERY_OUTPUT:?}" = 'true'; then
1568-
_send_text_to_recovery "${1:?}"
1569-
else
1570-
printf '%s\n' "${1:?}"
1571-
fi
1572-
}
1573-
1574-
ui_msg_sameline_start()
1575-
{
1576-
if test "${RECOVERY_OUTPUT:?}" = 'false'; then
1577-
printf '%s ' "${1:?}"
1578-
return
1579-
elif test -e "${RECOVERY_PIPE:?}"; then
1580-
printf 'ui_print %s' "${1:?}" >> "${RECOVERY_PIPE:?}"
1581-
else
1582-
printf 'ui_print %s' "${1:?}" 1>&"${OUTFD:?}"
1583-
fi
1584-
1585-
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1:?}"; fi
1586-
}
1587-
1588-
ui_msg_sameline_end()
1589-
{
1590-
if test "${RECOVERY_OUTPUT:?}" = 'false'; then
1591-
printf '%s\n' "${1:?}"
1592-
return
1593-
elif test -e "${RECOVERY_PIPE:?}"; then
1594-
printf '%s\nui_print\n' "${1:?}" >> "${RECOVERY_PIPE:?}"
1595-
else
1596-
printf '%s\nui_print\n' "${1:?}" 1>&"${OUTFD:?}"
1597-
fi
1598-
1599-
if test "${DEBUG_LOG_ENABLED:?}" -eq 1; then printf 1>&2 '%s\n' "${1:?}"; fi
1600-
}
1601-
1602-
ui_debug()
1603-
{
1604-
printf 1>&2 '%s\n' "${1?}"
1605-
}
1606-
16071609
# Error checking functions
16081610
validate_return_code()
16091611
{

0 commit comments

Comments
 (0)