From f2d225ee28198d2abe3fbb28765ddacf113e04db Mon Sep 17 00:00:00 2001 From: ailtonbsj Date: Wed, 8 May 2019 01:54:56 -0300 Subject: [PATCH] refactored scaffolding --- .gitignore | 1 + compile.sh | 3 ++ deb_package/DEBIAN/control | 11 +++++++ deb_package/DEBIAN/postinst | 30 ++++++++++++++++++ deb_package/DEBIAN/postrm | 9 ++++++ .../etc/skel/Desktop/proxy-linux-sc.desktop | 0 main => deb_package/usr/proxy-linux/main | 0 .../usr/proxy-linux/makeconf | 0 .../usr/proxy-linux/proxy.png | Bin .../usr/proxy-linux/supermain | 0 .../share/applications/proxy-linux.desktop | 0 install.sh | 15 ++++----- package.json | 2 +- 13 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100755 compile.sh create mode 100755 deb_package/DEBIAN/control create mode 100755 deb_package/DEBIAN/postinst create mode 100755 deb_package/DEBIAN/postrm rename proxy-linux-sc.desktop => deb_package/etc/skel/Desktop/proxy-linux-sc.desktop (100%) rename main => deb_package/usr/proxy-linux/main (100%) rename makeconf => deb_package/usr/proxy-linux/makeconf (100%) rename proxy.png => deb_package/usr/proxy-linux/proxy.png (100%) rename supermain => deb_package/usr/proxy-linux/supermain (100%) rename proxy-linux.desktop => deb_package/usr/share/applications/proxy-linux.desktop (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c776bdf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.deb \ No newline at end of file diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..46867d9 --- /dev/null +++ b/compile.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +dpkg-deb -b deb_package . \ No newline at end of file diff --git a/deb_package/DEBIAN/control b/deb_package/DEBIAN/control new file mode 100755 index 0000000..70cf9a8 --- /dev/null +++ b/deb_package/DEBIAN/control @@ -0,0 +1,11 @@ +Package: proxy-linux +Version: 1.1.3 +Installed-Size: +Maintainer: ailtonbsj +Section: utils +Architecture: all +Priority: optional +Depends: zenity +Homepage: https://github.com/ailtonbsj/proxy-linux +Description: Easy proxy service switching for browsers and others. + Essa ferramenta facilita o chaveamento rápido das configurações de proxy no ambiente linux. Modifica as configurações de proxy dos seguintes apps: Firefox, Google Chrome, Chromium, apt.conf e wgetrc. diff --git a/deb_package/DEBIAN/postinst b/deb_package/DEBIAN/postinst new file mode 100755 index 0000000..b5732a9 --- /dev/null +++ b/deb_package/DEBIAN/postinst @@ -0,0 +1,30 @@ +#!/bin/bash + +cat /etc/passwd | grep '/home/' | \ +grep -v 'cups\|syslog' | cut -d ':' -f 1 > /tmp/homes.list + +function geraShort { + echo "[Desktop Entry]" + echo "Type=Link" + cat $1 | \ + grep "Name=" | head -n1 + cat $1 | \ + grep "Name[pt_BR]=" | head -n1 + cat $1 | \ + grep "Icon=" | head -n1 + echo "URL=$2" +} + +while read USUARIO; do + geraShort /usr/share/applications/proxy-linux.desktop \ + /usr/share/applications/proxy-linux.desktop \ + > /home/$USUARIO/Desktop/proxy-linux-sc.desktop + geraShort /usr/share/applications/proxy-linux.desktop \ + /usr/share/applications/proxy-linux.desktop \ + > /home/$USUARIO/Área\ de\ Trabalho/proxy-linux-sc.desktop + + runuser -l $USUARIO -c "rm -rf /home/$USUARIO/.cache/" + if [ -f /usr/bin/lxpanelctl ]; then + su - $USUARIO -c "lxpanelctl restart" + fi +done < /tmp/homes.list diff --git a/deb_package/DEBIAN/postrm b/deb_package/DEBIAN/postrm new file mode 100755 index 0000000..bebe328 --- /dev/null +++ b/deb_package/DEBIAN/postrm @@ -0,0 +1,9 @@ +#!/bin/bash + +cat /etc/passwd | grep '/home/' | \ +grep -v 'cups\|syslog' | cut -d ':' -f 6 > /tmp/homes.list + +while read BASEDIR; do + rm -rf "$BASEDIR/Desktop/proxy-linux-sc.desktop" + rm -rf "$BASEDIR/Área de Trabalho/proxy-linux-sc.desktop" +done < /tmp/homes.list \ No newline at end of file diff --git a/proxy-linux-sc.desktop b/deb_package/etc/skel/Desktop/proxy-linux-sc.desktop similarity index 100% rename from proxy-linux-sc.desktop rename to deb_package/etc/skel/Desktop/proxy-linux-sc.desktop diff --git a/main b/deb_package/usr/proxy-linux/main similarity index 100% rename from main rename to deb_package/usr/proxy-linux/main diff --git a/makeconf b/deb_package/usr/proxy-linux/makeconf similarity index 100% rename from makeconf rename to deb_package/usr/proxy-linux/makeconf diff --git a/proxy.png b/deb_package/usr/proxy-linux/proxy.png similarity index 100% rename from proxy.png rename to deb_package/usr/proxy-linux/proxy.png diff --git a/supermain b/deb_package/usr/proxy-linux/supermain similarity index 100% rename from supermain rename to deb_package/usr/proxy-linux/supermain diff --git a/proxy-linux.desktop b/deb_package/usr/share/applications/proxy-linux.desktop similarity index 100% rename from proxy-linux.desktop rename to deb_package/usr/share/applications/proxy-linux.desktop diff --git a/install.sh b/install.sh index d3aa67f..573d64d 100755 --- a/install.sh +++ b/install.sh @@ -19,15 +19,12 @@ else #Install apt-get install zenity -y mkdir /usr/proxy-linux -p - cp main /usr/proxy-linux - cp makeconf /usr/proxy-linux - cp supermain /usr/proxy-linux - cp proxy.png /usr/proxy-linux - cp proxy-linux.desktop /usr/share/applications/ - cp proxy-linux-sc.desktop /home/*/Desktop - cp proxy-linux-sc.desktop /home/*/Área\ de\ Trabalho - #Install on Skell mkdir /etc/skel/Desktop -p - cp proxy-linux-sc.desktop /etc/skel/Desktop + cp -rf deb_package/usr/ / + cp -rf deb_package/etc/ / + cp deb_package/etc/skel/Desktop/proxy-linux-sc.desktop \ + /home/*/Desktop + cp deb_package/etc/skel/Desktop/proxy-linux-sc.desktop \ + /home/*/Área\ de\ Trabalho echo "Pronto!" fi \ No newline at end of file diff --git a/package.json b/package.json index 219bf3d..7134004 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proxy-linux", - "version": "1.1.2", + "version": "1.1.3", "description": "Easy proxy service switching for browsers and others", "main": "install.sh", "scripts": {