From 2b2d6a152de2ba6dd90fe0687d136e2eb6ccd989 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 8 Sep 2025 11:45:26 +0200 Subject: split AUR-related stuff to the aur branch --- .SRCINFO | 20 ------------------ .gitattributes | 2 -- .gitignore | 3 --- Makefile | 19 ----------------- PKGBUILD | 28 ------------------------- bin/.gitattributes | 1 + bin/reboot-into-windows | 43 +++++++++++++++++++++++++++++++++++++++ etc/sudoers | 1 + icon.svg | 1 - prelude.mk | 23 --------------------- reboot-into-windows | 43 --------------------------------------- reboot-into-windows.desktop | 8 -------- share/icon.svg | 1 + share/reboot-into-windows.desktop | 8 ++++++++ sudoers | 1 - 15 files changed, 54 insertions(+), 148 deletions(-) delete mode 100644 .SRCINFO delete mode 100644 .gitignore delete mode 100644 Makefile delete mode 100644 PKGBUILD create mode 100644 bin/.gitattributes create mode 100755 bin/reboot-into-windows create mode 100644 etc/sudoers delete mode 100644 icon.svg delete mode 100644 prelude.mk delete mode 100755 reboot-into-windows delete mode 100644 reboot-into-windows.desktop create mode 100644 share/icon.svg create mode 100644 share/reboot-into-windows.desktop delete mode 100644 sudoers diff --git a/.SRCINFO b/.SRCINFO deleted file mode 100644 index c17c348..0000000 --- a/.SRCINFO +++ /dev/null @@ -1,20 +0,0 @@ -pkgbase = reboot-into-windows - pkgdesc = Reboot into dual-booted Windows with a Bluetooth keyboard - pkgver = 0.2 - pkgrel = 1 - arch = any - license = MIT - depends = bash - depends = gawk - depends = grep - options = !debug - source = reboot-into-windows - source = reboot-into-windows.desktop - source = icon.svg - source = sudoers - sha256sums = SKIP - sha256sums = SKIP - sha256sums = SKIP - sha256sums = SKIP - -pkgname = reboot-into-windows diff --git a/.gitattributes b/.gitattributes index a2f2f07..176a458 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1 @@ * text=auto - -/reboot-into-windows text eol=lf diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 583cae5..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/src/ -/pkg/ -*.tar.zst diff --git a/Makefile b/Makefile deleted file mode 100644 index a21b0fe..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include prelude.mk - -PKG_NAME := reboot-into-windows - -.PHONY: all -all: build - -.PHONY: build -build: - makepkg --clean --cleanbuild --force --syncdeps && makepkg --printsrcinfo > .SRCINFO - -.PHONY: commit -commit: - git add .SRCINFO - source ./PKGBUILD && git commit -am "aur: $$pkgver-$$pkgrel" - -.PHONY: push -push: - git push 'ssh://aur@aur.archlinux.org/$(call escape,$(PKG_NAME)).git' "$$( git symbolic-ref HEAD ):master" diff --git a/PKGBUILD b/PKGBUILD deleted file mode 100644 index b601d8c..0000000 --- a/PKGBUILD +++ /dev/null @@ -1,28 +0,0 @@ -# Maintainer: Egor Tensin -pkgname=reboot-into-windows -pkgver=0.2 -pkgrel=1 -pkgdesc='Reboot into dual-booted Windows with a Bluetooth keyboard' -arch=(any) -license=(MIT) -depends=(bash gawk grep) -source=( - "$pkgname" - "$pkgname.desktop" - icon.svg - sudoers -) -sha256sums=( - SKIP - SKIP - SKIP - SKIP -) -options=('!debug') - -package() { - install -D -m 0755 -t "$pkgdir/usr/bin" "$srcdir/$pkgname" - install -D -m 0644 -t "$pkgdir/usr/share/applications" "$srcdir/$pkgname.desktop" - install -D -m 0644 -t "$pkgdir/usr/share/$pkgname" "$srcdir/icon.svg" - install -D -m 0640 -t "$pkgdir/etc/sudoers.d/reboot-into-windows" sudoers -} diff --git a/bin/.gitattributes b/bin/.gitattributes new file mode 100644 index 0000000..c9f8ef4 --- /dev/null +++ b/bin/.gitattributes @@ -0,0 +1 @@ +reboot-into-windows text eol=lf diff --git a/bin/reboot-into-windows b/bin/reboot-into-windows new file mode 100755 index 0000000..a6584b9 --- /dev/null +++ b/bin/reboot-into-windows @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail +shopt -s inherit_errexit lastpipe + +readonly cfg_path=/boot/grub/grub.cfg + +get_windows_menu_entry() { + local windows_entries + windows_entries="$( awk -F\' '/menuentry / {print $2}' "$cfg_path" | grep -Fi Windows )" + + local numof_entries + numof_entries="$( echo "$windows_entries" | wc -l )" + + if [ "$numof_entries" -ne 1 ]; then + echo "Don't know which one of the following entries to select:" >&2 + echo "$windows_entries" >&2 + return 1 + fi + + echo "$windows_entries" +} + +main() { + local entry + entry="$( get_windows_menu_entry )" + + # grub-reboot returns 0 even if something like a permission error happens. + # It does print something in that case though, and nothing after a + # successful termination. + local output + output="$( grub-reboot "$entry" )" + + if [ -n "$output" ]; then + echo "grub-reboot probably exited with an error:" >&2 + echo "$output" >&2 + return 1 + fi + + reboot +} + +main diff --git a/etc/sudoers b/etc/sudoers new file mode 100644 index 0000000..4bb7722 --- /dev/null +++ b/etc/sudoers @@ -0,0 +1 @@ +ALL ALL=(ALL) NOPASSWD: /usr/bin/reboot-into-windows diff --git a/icon.svg b/icon.svg deleted file mode 100644 index 4fbbd4e..0000000 --- a/icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/prelude.mk b/prelude.mk deleted file mode 100644 index da836d7..0000000 --- a/prelude.mk +++ /dev/null @@ -1,23 +0,0 @@ -# Please see https://tensin.name/blog/notes/makefile.html - -MAKEFLAGS += --no-builtin-rules --no-builtin-variables --warn-undefined-variables -unexport MAKEFLAGS -.DEFAULT_GOAL := all -.DELETE_ON_ERROR: -.SUFFIXES: -SHELL := bash -.SHELLFLAGS := -eu -o pipefail -c - -escape = $(subst ','\'',$(1)) - -define noexpand -ifeq ($$(origin $(1)),environment) - $(1) := $$(value $(1)) -endif -ifeq ($$(origin $(1)),environment override) - $(1) := $$(value $(1)) -endif -ifeq ($$(origin $(1)),command line) - override $(1) := $$(value $(1)) -endif -endef diff --git a/reboot-into-windows b/reboot-into-windows deleted file mode 100755 index a6584b9..0000000 --- a/reboot-into-windows +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -o nounset -o pipefail -shopt -s inherit_errexit lastpipe - -readonly cfg_path=/boot/grub/grub.cfg - -get_windows_menu_entry() { - local windows_entries - windows_entries="$( awk -F\' '/menuentry / {print $2}' "$cfg_path" | grep -Fi Windows )" - - local numof_entries - numof_entries="$( echo "$windows_entries" | wc -l )" - - if [ "$numof_entries" -ne 1 ]; then - echo "Don't know which one of the following entries to select:" >&2 - echo "$windows_entries" >&2 - return 1 - fi - - echo "$windows_entries" -} - -main() { - local entry - entry="$( get_windows_menu_entry )" - - # grub-reboot returns 0 even if something like a permission error happens. - # It does print something in that case though, and nothing after a - # successful termination. - local output - output="$( grub-reboot "$entry" )" - - if [ -n "$output" ]; then - echo "grub-reboot probably exited with an error:" >&2 - echo "$output" >&2 - return 1 - fi - - reboot -} - -main diff --git a/reboot-into-windows.desktop b/reboot-into-windows.desktop deleted file mode 100644 index 122ed82..0000000 --- a/reboot-into-windows.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Reboot into Windows -Comment=Use grub-reboot to reboot into Windows -Terminal=false -Exec=sudo reboot-into-windows -Icon=/usr/share/reboot-into-windows/icon.svg -Categories=System diff --git a/share/icon.svg b/share/icon.svg new file mode 100644 index 0000000..4fbbd4e --- /dev/null +++ b/share/icon.svg @@ -0,0 +1 @@ + diff --git a/share/reboot-into-windows.desktop b/share/reboot-into-windows.desktop new file mode 100644 index 0000000..122ed82 --- /dev/null +++ b/share/reboot-into-windows.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Reboot into Windows +Comment=Use grub-reboot to reboot into Windows +Terminal=false +Exec=sudo reboot-into-windows +Icon=/usr/share/reboot-into-windows/icon.svg +Categories=System diff --git a/sudoers b/sudoers deleted file mode 100644 index 4bb7722..0000000 --- a/sudoers +++ /dev/null @@ -1 +0,0 @@ -ALL ALL=(ALL) NOPASSWD: /usr/bin/reboot-into-windows -- cgit v1.2.3