This repository has been archived by the owner on May 22, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The master branch now completely belongs to web-greeter 3.0 😤
- Loading branch information
Showing
22 changed files
with
134 additions
and
3,570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
# Top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# Indent With Tabs | ||
indent_style = tab | ||
indent_size = tab | ||
tab_width = 4 | ||
|
||
# UTF-8 | ||
charset = utf-8 | ||
|
||
|
||
max_line_length = 99 | ||
charset = utf-8 | ||
continuation_indent_size = 4 | ||
indent_brace_style = 1TBS | ||
curly_bracket_next_line = false | ||
curly_bracket_next_line = false | ||
end_of_line = lf | ||
indent_brace_style = 1TBS | ||
indent_size = 4 | ||
indent_style = tab | ||
insert_final_newline = true | ||
max_line_length = 99 | ||
tab_width = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.py] | ||
indent_style = space | ||
|
||
[*.yml] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,140 @@ | ||
#!/bin/bash | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
BUILD_DIR="$(realpath $(dirname "${BASH_SOURCE[0]}"))" | ||
REPO_DIR="$(dirname "${BUILD_DIR}")" | ||
INSTALL_ROOT="${BUILD_DIR}/install_root" | ||
PKGNAME='web-greeter' | ||
DESTDIR='' | ||
|
||
|
||
_handle_error() { | ||
LASTLINE="$1" | ||
LASTERR="$2" | ||
echo "${BASH_SOURCE[0]}: line ${LASTLINE}: exit status of last command: ${LASTERR}" | ||
exit 1 | ||
} | ||
|
||
clean_build_dir() { | ||
(cd "${DIR}" \ | ||
&& find . -type f ! -path './ci*' ! -name '.gitignore' ! -name utils.sh -delete \ | ||
&& find . -type d ! -path './ci' -delete \ | ||
&& { rm ../src/gresource/js/bundle.js || true; }) | ||
find "${BUILD_DIR}" -type f ! -path '*/ci/*' ! -name utils.sh -delete | ||
find "${BUILD_DIR}" -type d ! -name build ! -path '*/ci' -delete | ||
} | ||
|
||
combine_javascript_sources() { | ||
cd "${MESON_SOURCE_ROOT}/src/gresource/js" && { | ||
cat _vendor/moment-with-locales.min.js \ | ||
LightDMObjects.js \ | ||
Greeter.js \ | ||
GreeterConfig.js \ | ||
ThemeUtils.js > "${MESON_SOURCE_ROOT}/src/gresource/js/bundle.js" | ||
} | ||
cd "${BUILD_DIR}/${PKGNAME}/resources/js" | ||
cat _vendor/moment-with-locales.min.js \ | ||
ThemeUtils.js \ | ||
bootstrap.js > bundle.js | ||
} | ||
|
||
do_build() { | ||
(cd "$(dirname "${DIR}")" \ | ||
&& meson build \ | ||
&& cd build \ | ||
&& ninja) | ||
cd "${BUILD_DIR}" | ||
|
||
# Compile Resources | ||
(combine_javascript_sources \ | ||
&& pyrcc5 -o ../../resources.py ../resources.qrc) | ||
|
||
# Create "Zip Application" | ||
(cd "${PKGNAME}" \ | ||
&& mv greeter.py __main__.py \ | ||
&& zip -rq ../"${PKGNAME}.zip" . -x '**__pycache__**' 'resources/*' \ | ||
&& cd - >/dev/null \ | ||
&& mkdir -p "${INSTALL_ROOT}"/usr/{bin,share} \ | ||
&& echo '#!/bin/python' >> "${INSTALL_ROOT}/usr/bin/web-greeter" \ | ||
&& cat web-greeter.zip >> "${INSTALL_ROOT}/usr/bin/web-greeter" \ | ||
&& chmod +x "${INSTALL_ROOT}/usr/bin/web-greeter") | ||
} | ||
|
||
do_install() { | ||
cd "${BUILD_DIR}" | ||
mkdir -p \ | ||
"${INSTALL_ROOT}"/usr/share/{man/man1,metainfo,web-greeter,xgreeters} \ | ||
"${INSTALL_ROOT}/etc/lightdm" | ||
|
||
# Themes | ||
(cp -R "${REPO_DIR}/themes" "${INSTALL_ROOT}/usr/share/web-greeter" \ | ||
&& cd "${INSTALL_ROOT}/usr/share/web-greeter" \ | ||
&& mv themes/_vendor .) | ||
|
||
# Man Page | ||
cp "${REPO_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}/usr/share/man/man1" | ||
|
||
# Greeter Config | ||
cp "${REPO_DIR}/dist/${PKGNAME}.conf" "${INSTALL_ROOT}/etc/lightdm" | ||
|
||
# AppData File | ||
cp "${REPO_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}/usr/share/metainfo" | ||
|
||
# Desktop File | ||
cp "${REPO_DIR}/dist/com.antergos.${PKGNAME}.desktop" "${INSTALL_ROOT}/usr/share/xgreeters" | ||
|
||
# Do Install! | ||
[[ -e "${DESTDIR}" ]] || mkdir -p "${DESTDIR}" | ||
cp -R "${INSTALL_ROOT}"/* "${DESTDIR}" | ||
|
||
# Fix Permissions | ||
chown -R "${SUDO_UID}:${SUDO_GID}" "${BUILD_DIR}" | ||
} | ||
|
||
do_quick_install() { | ||
(cd "${DIR}/src" \ | ||
&& sudo cp lightdm-webkit2-greeter /usr/bin \ | ||
&& sudo cp liblightdm-webkit2-greeter-webext.so /usr/lib/lightdm-webkit2-greeter \ | ||
&& sudo cp -R ../../themes/antergos /usr/share/lightdm-webkit/themes) | ||
do_success() { | ||
NO_COLOR=\x1b[0m | ||
SUCCESS_COLOR=\x1b[32;01m | ||
SUCCESS="${SUCCESS_COLOR}[SUCCESS!]${NO_COLOR}" | ||
echo "${SUCCESS}" | ||
} | ||
|
||
generate_pot_file() { | ||
REPO_ROOT="$(dirname "${DIR}")" | ||
REPO_ROOT="$(dirname "${REPO_DIR}")" | ||
xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/lightdm-webkit2-greeter.pot" -d lightdm-webkit2-greeter "${REPO_ROOT}"/src/*.c | ||
} | ||
|
||
list_javascript_sources() { | ||
cd "${MESON_SOURCE_ROOT}/src" && find gresource/js -type f -name '*.js' -print | ||
init_build_dir() { | ||
[[ -e "${BUILD_DIR}/web-greeter" ]] && return 0 | ||
cp -R "${REPO_DIR}/web-greeter" "${BUILD_DIR}" | ||
} | ||
|
||
set_config() { | ||
( [[ -z "$1" ]] || [[ -z "$2" && -z "$3" ]] ) && return 1 | ||
local KEY VALUE | ||
|
||
KEY="$1" | ||
[[ '' != "$2" ]] && VALUE="$2" || VALUE="$3" | ||
|
||
sed -i "s|@${KEY}@|@${VALUE}@|g" "${BUILD_DIR}/web-greeter/whither.yml" | ||
} | ||
|
||
|
||
# Catch Command Errors | ||
trap '_handle_error ${LINENO} ${$?}' ERR | ||
|
||
cd "${REPO_DIR}/build" >/dev/null | ||
|
||
case "$1" in | ||
combine-js) | ||
combine_javascript_sources | ||
;; | ||
|
||
get-js-files) | ||
list_javascript_sources | ||
;; | ||
|
||
clean-build-dir) | ||
clean) | ||
clean_build_dir | ||
;; | ||
|
||
build) | ||
clean_build_dir && do_build | ||
do_build | ||
;; | ||
|
||
build-dev) | ||
clean_build_dir && do_build && do_quick_install | ||
build-init) | ||
init_build_dir | ||
;; | ||
|
||
gen-pot) | ||
generate_pot_file | ||
;; | ||
|
||
install) | ||
DESTDIR="$2" | ||
do_install | ||
;; | ||
|
||
set-config) | ||
set_config "$2" "$3" "$4" | ||
;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.