parent
d0e1185f29
commit
fafed3ac31
@ -0,0 +1,25 @@ |
||||
PREFIX?=${HOME}/.local
|
||||
BINDIR?=$(PREFIX)/bin
|
||||
SITEDIR?=$(BINDIR)/nativefier
|
||||
SHAREDIR?=$(PREFIX)/share/mknative
|
||||
ICONDIR?=$(SHAREDIR)/icons
|
||||
|
||||
RM?=rm -f
|
||||
|
||||
help: |
||||
@echo 'Makefile for mknative '
|
||||
@echo ' '
|
||||
@echo ' install '
|
||||
@echo ' uninstall '
|
||||
|
||||
install: |
||||
mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SITEDIR) $(DESTDIR)$(ICONDIR)
|
||||
install -m755 mknative $(DESTDIR)$(BINDIR)/mknative
|
||||
install -m755 runnative $(DESTDIR)$(BINDIR)/runnative
|
||||
install -m755 icons/* $(DESTDIR)$(ICONDIR)
|
||||
|
||||
uninstall: |
||||
$(RM) $(DESTDIR)$(BINDIR)/mknative
|
||||
$(RM) $(DESTDIR)$(BINDIR)/runnative
|
||||
|
||||
.DEFAULT_GOAL := help
|
After Width: | Height: | Size: 4.8 KiB |
@ -0,0 +1,59 @@ |
||||
#!/bin/bash |
||||
# Make a 'native app' wrapper using nativefier for a site. |
||||
|
||||
usage() { echo "Usage: $0 -u -s https://example.com -n NativeExample"; exit 1; } |
||||
|
||||
while getopts "us:n:" option; do |
||||
case ${option} in |
||||
u) |
||||
uninstall=1 |
||||
echo "Uninstalling ..." |
||||
;; |
||||
s) |
||||
url=${OPTARG} |
||||
echo "URL: $url" |
||||
;; |
||||
n) |
||||
name=${OPTARG} |
||||
echo "Name: $name" |
||||
;; |
||||
*) |
||||
usage |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
if [ -n "${uninstall}" ]; then |
||||
if [ -z "${name}" ]; then |
||||
usage |
||||
fi |
||||
|
||||
rm ~/.local/share/applications/$name.desktop |
||||
rm -r ~/.local/bin/nativefier/${name}-*/ |
||||
|
||||
exit 0 |
||||
fi |
||||
|
||||
if [ -z "${name}" ] || [ -z "${url}" ]; then |
||||
usage |
||||
fi |
||||
|
||||
docker run --privileged -ti \ |
||||
-v $HOME/.local/bin/nativefier:/target/ \ |
||||
-v $HOME/.local/share/mknative/icons:/src \ |
||||
jiahaog/nativefier:latest \ |
||||
--name $name \ |
||||
--icon /src/$name.png \ |
||||
-p linux \ |
||||
-a x64 \ |
||||
$url \ |
||||
/target/ |
||||
|
||||
echo " |
||||
[Desktop Entry] |
||||
Type=Application |
||||
Exec=$HOME/.local/bin/runnative $name |
||||
Icon=${HOME}/.local/share/mknative/icons/${name}.png |
||||
Terminal=false |
||||
Name=$name |
||||
" > ~/.local/share/applications/$name.desktop |
Loading…
Reference in new issue