main/reboot-mode: build from new repo (!694)
This commit is contained in:
parent
f2c41d7e5e
commit
34f6f86f08
2 changed files with 6 additions and 58 deletions
|
@ -1,16 +1,15 @@
|
||||||
# Contributor: Daniele Debernardi <drebrez@gmail.com>
|
# Contributor: Daniele Debernardi <drebrez@gmail.com>
|
||||||
# Maintainer: Daniele Debernardi <drebrez@gmail.com>
|
# Maintainer: Daniele Debernardi <drebrez@gmail.com>
|
||||||
pkgname=reboot-mode
|
pkgname=reboot-mode
|
||||||
pkgver=0.2
|
pkgver=1.0.0
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Reboot the device to a specific mode"
|
pkgdesc="Reboot the device to a specific mode"
|
||||||
url="https://postmarketos.org"
|
url="https://postmarketos.org"
|
||||||
arch="all"
|
arch="all"
|
||||||
license="GPL-3.0-or-later"
|
license="GPL-3.0-or-later"
|
||||||
makedepends="musl-dev linux-headers"
|
makedepends="musl-dev linux-headers"
|
||||||
source="reboot-mode.c"
|
source="https://gitlab.com/postmarketos/reboot-mode/-/archive/$pkgver/reboot-mode-$pkgver.tar.gz"
|
||||||
options="!check"
|
options="!check" # No tests
|
||||||
builddir="$srcdir/"
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
gcc reboot-mode.c -o reboot-mode.o -c
|
gcc reboot-mode.c -o reboot-mode.o -c
|
||||||
|
@ -18,8 +17,8 @@ build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm755 "reboot-mode" \
|
install -Dm755 reboot-mode \
|
||||||
"${pkgdir}/usr/sbin/reboot-mode"
|
"$pkgdir"/usr/sbin/reboot-mode
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="a0cd4097d24fb6c66edce60558942d18ccf45925013013e5af5437471b1a855abe12857deb45b5f970b04e8b9dba99177b9080fff584fbd16262f0a7aabbf4b1 reboot-mode.c"
|
sha512sums="926fae6f1b78b144f092d291f1d0edf58f2a5ea98d3af7aa812f4f1e1330002feb5a8c4499fe334e6d22bc515467359a5a0651e3995d2217a844f3c1b668ae9b reboot-mode-1.0.0.tar.gz"
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
/*
|
|
||||||
* Reboot the device to a specific mode
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 Daniele Debernardi <drebrez@gmail.com>
|
|
||||||
*/
|
|
||||||
#include <errno.h>
|
|
||||||
#include <linux/reboot.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
void usage(char *appname)
|
|
||||||
{
|
|
||||||
printf("Usage: %s [-h] MODE\n\n", appname);
|
|
||||||
printf("Reboot the device to the MODE specified (e.g. recovery, bootloader)\n\n");
|
|
||||||
printf("WARNING: the reboot is instantaneous\n\n");
|
|
||||||
printf("optional arguments:\n");
|
|
||||||
printf(" -h Show this help message and exit\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc != 2) {
|
|
||||||
usage(argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int opt;
|
|
||||||
while ((opt = getopt(argc, argv, "h")) != -1) {
|
|
||||||
switch (opt) {
|
|
||||||
case 'h':
|
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sync();
|
|
||||||
|
|
||||||
int ret;
|
|
||||||
ret = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, argv[1]);
|
|
||||||
|
|
||||||
if (ret < 0) {
|
|
||||||
printf("Error: %s\n", strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
Loading…
Reference in a new issue