Skip to content

Commit

Permalink
Merge pull request #83 from safing/fix/v1-releases
Browse files Browse the repository at this point in the history
Fix releasing
  • Loading branch information
dhaavi authored May 31, 2023
2 parents e262df4 + da4c912 commit 7d9f677
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 45 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Linux

on:
push:
branches: [ master ]
branches: [ master, develop ]
pull_request:
branches: [ master ]
branches: [ master, develop ]

jobs:
shellcheck:
Expand All @@ -14,6 +14,10 @@ jobs:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
# SC1091: Ignore included files that cannot be found.
# SC2181: Ignore exit code style.
SHELLCHECK_OPTS: -e SC1091 -e SC2181
with:
ignore_paths: windows linux/templates linux/tests

Expand Down Expand Up @@ -75,7 +79,6 @@ jobs:
run: yes | sudo bash ./install.sh --assets-url file://$(echo $(pwd)/installer-assets-*.tar.gz)
working-directory: linux

- uses: actions/checkout@v2
- name: Verify installation
run: ./linux/tests/test-install.sh

Expand Down Expand Up @@ -209,7 +212,7 @@ jobs:
- fedora:32
- fedora:33
- fedora:34
- centos:7
# - centos:7
container: ${{ matrix.container }}
steps:
- uses: actions/download-artifact@v2
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Windows

on:
push:
branches: [ master ]
branches: [ master, develop ]
pull_request:
branches: [ master ]
branches: [ master, develop ]

jobs:
build-nsis:
Expand All @@ -19,4 +19,3 @@ jobs:
with:
name: ${{ steps.build.outputs.filename }}
path: ${{ steps.build.outputs.filename }}

2 changes: 1 addition & 1 deletion linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ gen-archive: nfpm.yaml icons
gomplate -d "nfpm=./nfpm.yaml" -f templates/create-archive.sh | bash

lint:
shellcheck ./scripts/* ./arch.install
shellcheck ./scripts/* ./arch.install
46 changes: 25 additions & 21 deletions linux/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -- $(getopt -u -o uhd:t: -l no-color,no-download,purge,uninstall,no-upgrade,debug,help,assets-url:,start-url:,arch:,tmp-dir: -n 'portmaster-installer' -- "$@")
TEMP=$(getopt -u -o uhd:t: -l no-color,no-download,purge,uninstall,no-upgrade,debug,help,assets-url:,start-url:,arch:,tmp-dir: -n 'portmaster-installer' -- "$@")
eval set -- "$TEMP"

if [[ $? -ne 0 ]]; then
exit 1
Expand Down Expand Up @@ -164,12 +165,12 @@ download_pmstart() {
copy_icons() {
local failure=0
for res in /opt/safing/portmaster/icons/* ; do
cp $res/* "/usr/share/icons/hicolor/$(basename $res)" >/dev/null 2>&1 || failure=1
cp "$res"/* "/usr/share/icons/hicolor/$(basename "$res")" >/dev/null 2>&1 || failure=1

if [[ $failure -ne 0 ]]; then
break
fi
echo "/usr/share/icons/hicolor/$(basename $res)" >> /opt/safing/portmaster/.installed-files
echo "/usr/share/icons/hicolor/$(basename "$res")" >> /opt/safing/portmaster/.installed-files
done

if [[ $failure -ne 0 ]]; then
Expand Down Expand Up @@ -201,8 +202,8 @@ install_or_upgrade() {
assets="${tmp_dir}/assets.tar.gz"
pmstart="${tmp_dir}/portmaster-start"

download_assets $assets
download_pmstart $pmstart
download_assets "$assets"
download_pmstart "$pmstart"

if [[ "${upgrade}" != "yes" ]]; then
log info "Creating /opt/safing/portmaster"
Expand All @@ -214,8 +215,11 @@ install_or_upgrade() {

# Untar the archive on root
log info "Extracting assets to /opt/safing/portmaster"
tar --extract --no-same-owner --no-same-permissions --no-overwrite-dir -m --file="${assets}"
cp ${pmstart} /opt/safing/portmaster/portmaster-start
tar --extract --no-same-owner --no-overwrite-dir -m --file="${assets}"
log info "Fixing asset permissions"
chmod -R a+r /opt/safing/portmaster

cp "${pmstart}" /opt/safing/portmaster/portmaster-start
chmod 0755 /opt/safing/portmaster/portmaster-start

log success "Extracted assets to /opt/safing/portmaster"
Expand Down Expand Up @@ -274,7 +278,7 @@ remove() {
pre_remove "$1"

# for the next steps we need to switch to the system root
cat .installed-files | xargs rm -v 2>/dev/null >&2
xargs rm -v 2>/dev/null >&2 <.installed-files
log success "Installed files deleted"

log info "Running post-remove scripts ..."
Expand All @@ -290,56 +294,56 @@ fi

while true; do
case "$1" in
--debug )
--debug)
set -x
shift
;;
--assets-url )
--assets-url)
asset_url="$2"
shift 2
;;
--start-url )
--start-url)
start_url="$2"
shift 2
;;
--arch )
--arch)
arch="$2"
shift 2
;;
-t | --tmp-dir )
-t|--tmp-dir)
tmp_dir="$2"
remove_tmp="no"
shift 2
;;
-h | --help )
-h|--help)
print_help
exit 0
;;
--no-upgrade )
--no-upgrade)
upgrade="no"
shift
;;
-u | --uninstall )
-u|--uninstall)
action="uninstall"
shift
;;
--purge )
--purge)
action="purge"
shift
;;
--no-download )
--no-download)
skip_downloads="True"
shift
;;
--no-color )
--no-color)
colorize="no"
shift
;;
-- )
--)
shift
break
;;
* )
*)
break
;;
esac
Expand Down
13 changes: 5 additions & 8 deletions linux/nfpm.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ scripts:

overrides:
deb:
depends:
- libc6
- libnetfilter-queue1
# depends:
# - libc6
# - libnetfilter-queue1
recommends:
- libappindicator3-1
# - gir1.2-harfbuzz-0.0
# - gir1.2-harfbuzz-0.0
rpm:
depends:
- glibc-devel
- libnetfilter_queue
recommends:
- libappindicator
suggests:
Expand All @@ -98,4 +95,4 @@ deb:
triggers:
activate:
- update-icon-caches
- update-desktop-database
- update-desktop-database
2 changes: 1 addition & 1 deletion linux/pkgrev
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
1
8 changes: 4 additions & 4 deletions linux/release_to_aur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
source tests/common.sh

if [ ! -e ./PKGBUILD ]; then
error 'Run `make gen-pkgbuild` first'
error "Run first: make gen-pkgbuild"
exit 1
fi

if [ -z $GITHUB_COMMIT_MESSAGE ]; then
if [ -z "$GITHUB_COMMIT_MESSAGE" ]; then
error "No commit message defined in GITHUB_COMMIT_MESSAGE"
exit 1
fi
Expand All @@ -33,7 +33,7 @@ group "Copying files to AUR repository"
endgroup

cd "${target}"
if [[ `git status --porcelain` ]]; then
if [[ $(git status --porcelain) ]]; then
# we only generate a new .SRCINFO file if we have actual changes to the AUR repo
# that we want to publish.
group "Generating .SRCINFO"
Expand All @@ -48,4 +48,4 @@ if [[ `git status --porcelain` ]]; then
endgroup
else
info "No changes detected, aborting"
fi
fi
10 changes: 9 additions & 1 deletion linux/templates/create-archive.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ done
# Copy the arch.install file into our assets
cp archive.install "${pkgdir}/.INSTALL.sh"

# Fix file permissions for archive.
(
cd ${pkgdir} &&
find . -type d -exec chmod 0755 {} \; &&
find . -type f -exec chmod 0644 {} \; &&
find . -type f -name "*.sh" -exec chmod 0755 {} \;
)

# Create filelist to support easy uninstallation
# like doing a `cat /opt/safing/portmaster/.installed-files | sudo xargs rm`
( cd ${pkgdir} && find . -type f ) >> ${pkgdir}/.installed-files
( cd ${pkgdir} && find . -type f ) > ${pkgdir}/.installed-files

# Create archive
( cd ${pkgdir} && tar cfz ../installer-assets-{{ $nfpm.version }}.tar.gz . )
Expand Down
Empty file modified linux/templates/no-log-install.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/postinstall.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/postremove.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/preinstall.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/preremove.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/common.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/install-systemd-utils.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/post-install.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/post-remove.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/post-upgrade.sh
100644 → 100755
Empty file.
Empty file modified linux/templates/snippets/pre-remove.sh
100644 → 100755
Empty file.
Empty file modified linux/tests/common.sh
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions linux/tests/test-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
. ${SCRIPT_DIR}/common.sh

group "Directory Permissions"
ls -lah /opt/safing/portmaster
endgroup

#
# Perform our tests
#
Expand All @@ -28,6 +32,7 @@ group "Systemd Integration"
#
if ! [ "${VERSION}" = "19 (Tara)" ] || is_systemd_running ; then # Skip systemd tests on Mint19 ...
debug "Use systemd-analyze to verify portmaster.service"

if ! systemd-analyze verify portmaster.service ; then
error "systemd-analyze returned an error for portmaster.service"
else
Expand Down
4 changes: 2 additions & 2 deletions windows/portmaster-installer.nsi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Unicode true ; The Multi-Language-Part is a modified version of the MultiLanguage-NSIS-Example

!define PRODUCT_VERSION "0.8.8.1"
!define VERSION "0.8.8.1"
!define PRODUCT_VERSION "1.0.13.0"
!define VERSION "1.0.13.0"

VIProductVersion "${PRODUCT_VERSION}"
VIFileVersion "${VERSION}"
Expand Down

0 comments on commit 7d9f677

Please sign in to comment.