add needed package part-1

This commit is contained in:
Ertuğrul Erata
2015-08-05 14:45:59 +03:00
parent 82cec90e03
commit 5ea757b7a3
32 changed files with 1423 additions and 0 deletions
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import shelltools
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
def setup():
#autotools.autoreconf("-vif")
autotools.configure("--enable-threads \
--enable-compress \
--enable-plymouth \
--disable-encrypt \
--disable-resume-static \
--with-initramfsdir=/usr/sbin")
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.removeDir("/dev")
shelltools.touch("%s/etc/suspend.key" % get.installDIR())
@@ -0,0 +1,22 @@
--- suspend-0.8.20080612/bootsplash.c.printf_format 2009-02-04 09:45:15.000000000 +0100
+++ suspend-0.8.20080612/bootsplash.c 2009-02-04 10:03:01.000000000 +0100
@@ -118,7 +118,7 @@ int bootsplash_dialog(const char *prompt
{
int ret;
bootsplash_to_verbose();
- printf(prompt);
+ printf("%s", prompt);
ret = getchar();
bootsplash_to_silent();
--- suspend-0.8.20080612/splash.c.printf_format 2009-02-04 09:45:15.000000000 +0100
+++ suspend-0.8.20080612/splash.c 2009-02-04 09:56:30.000000000 +0100
@@ -53,7 +53,7 @@ static void splash_dummy_readpass(char *
static int splash_dialog(const char *prompt)
{
- printf(prompt);
+ printf("%s", prompt);
return getchar();
}
@@ -0,0 +1,27 @@
Index: suspend-0.8_20100831/resume.c
===================================================================
--- suspend-0.8_20100831.orig/resume.c
+++ suspend-0.8_20100831/resume.c
@@ -471,19 +471,9 @@ int main(int argc, char *argv[])
while (stat(resume_dev_name, &stat_buf)) {
fprintf(stderr,
- "%s: Could not stat the resume device file '%s'\n"
- "\tPlease type in the full path name to try again\n"
- "\tor press ENTER to boot the system: ", my_name,
- resume_dev_name);
- fgets(resume_dev_name, MAX_STR_LEN - 1, stdin);
- n = strlen(resume_dev_name) - 1;
- if (n <= 0) {
- error = EINVAL;
- goto Free;
- }
-
- if (resume_dev_name[n] == '\n')
- resume_dev_name[n] = '\0';
+ "%s: Could not stat the resume device file '%s'\n", my_name, resume_dev_name);
+ error = EINVAL;
+ goto Free;
}
setvbuf(stdout, NULL, _IONBF, 0);
@@ -0,0 +1,50 @@
Index: suspend-0.8_20100831/splash.c
===================================================================
--- suspend-0.8_20100831.orig/splash.c
+++ suspend-0.8_20100831/splash.c
@@ -206,7 +206,7 @@ void splash_prepare(struct splash *splas
if (!mode)
return;
- printf("Looking for splash system... ");
+ /*printf("Looking for splash system... ");*/
if (!bootsplash_open()) {
splash->finish = bootsplash_finish;
@@ -246,12 +246,12 @@ void splash_prepare(struct splash *splas
} else if (0) {
/* add another splash system here */
} else {
- printf("none\n");
+ /*printf("none\n");*/
if (!open_input_fd())
splash->key_pressed = key_pressed;
return;
}
- printf("found\n");
+ /*printf("found\n");*/
splash->progress(0);
}
Index: suspend-0.8_20100831/suspend.c
===================================================================
--- suspend-0.8_20100831.orig/suspend.c
+++ suspend-0.8_20100831/suspend.c
@@ -1733,7 +1733,7 @@ int suspend_system(int snapshot_fd, int
}
sprintf(message, "Snapshotting system");
- printf("%s: %s\n", my_name, message);
+ /*printf("%s: %s\n", my_name, message);*/
splash.set_caption(message);
attempts = 2;
do {
@@ -1748,7 +1748,7 @@ int suspend_system(int snapshot_fd, int
if (!in_suspend) {
/* first unblank the console, see console_codes(4) */
printf("\e[13]");
- printf("%s: returned to userspace\n", my_name);
+ /*printf("%s: returned to userspace\n", my_name);*/
free_snapshot(snapshot_fd);
break;
}
@@ -0,0 +1,75 @@
#!/bin/bash
#
# configuration script for encrypted suspend
#
# (C) 2008 Stefan Seyfried <seife@suse.de> SUSE Linux Products GmbH
# released under the GPL V2
CONF=/etc/suspend.conf
if [ $UID != 0 ]; then
echo "Sorry, this configuration script needs root privileges."
echo "Exiting now..."
echo
exit 1
fi
cat <<EOF
We are going to create the key for encrypted suspend now. There are some
questions we need to ask for:
- Key size.
The longer the key, the harder it will be to break the encryption.
On the other hand, the longer the key, the more computational power is
needed, which means that the suspend and resume will be slightly slower.
Nowadays, 1024 bits of key length might be too insecure for some users,
the default of 2048 bits should be fine.
- Your passphrase. This passphrase protects the generated key. It should
be sufficiently long and not easy to guess.
This is the password you need to enter to resume from encrypted suspend.
To make sure that you did not mistype the passphrase, you need to confirm
it by entering it a second time.
The program will create the key and copy it to /etc/suspend.key, then it
will modify /etc/suspend.conf that from now on your suspend to disk image
will be encrypted. Note that creating the key might take some time,
depending on your machine. You can probably speed it up by using the mouse
and generating I/O, e.g. by starting other programs.
If you do not want to continue, press CTRL-C now.
EOF
# -q suppresses asking for the key file and makes it default
# to /etc/suspend.key
suspend-keygen -q
if [ $? != 0 ]; then
echo
echo "Something went wrong. Please check above for error messages."
echo "/etc/suspend.conf is not modified."
echo
exit 1
fi
echo "We successfully generated /etc/suspend.key. Modifying suspend.conf now."
# backup...
cp -a $CONF ${CONF}.backup
# remove the encrypt and keyfile entries from the config file.
# the key file will default to /etc/suspend.key anyway
sed -i '/^encrypt /d;/^RSA key file /d;' $CONF
echo "encrypt = y" >> $CONF
# if we have more than one CPU / core, enabling threads will speed up
# suspend.
NUMCPU=$(grep -c ^processor /proc/cpuinfo)
if [ $NUMCPU -gt 1 ]; then
# remove the threads setting...
sed -i '/^threads /d; ' $CONF
# ..and add it back.
echo "threads = y" >> $CONF
fi
echo
echo "/etc/suspend.conf written, you can find the original file as /etc/suspend.conf.backup"
echo
@@ -0,0 +1,16 @@
Index: b/suspend.c
===================================================================
--- a/suspend.c
+++ b/suspend.c
@@ -1261,6 +1261,11 @@ Shutdown:
Unfreeze:
unfreeze(snapshot_fd);
+ /* ugly hack, because "user aborted suspend" is not really
+ * an error.
+ */
+ if (error == EINTR)
+ return 0;
return error;
}
@@ -0,0 +1,79 @@
Index: b/suspend.c
===================================================================
--- a/suspend.c
+++ b/suspend.c
@@ -1772,11 +1772,10 @@ int suspend_system(int snapshot_fd, int
if (error)
goto Shutdown;
reset_signature(resume_fd);
free_swap_pages(snapshot_fd);
free_snapshot(snapshot_fd);
- s2ram_resume();
goto Unfreeze;
}
Shutdown:
#endif
close(resume_fd);
@@ -2268,11 +2267,11 @@ int main(int argc, char *argv[])
struct stat stat_buf;
int resume_fd, snapshot_fd, vt_fd, orig_vc = -1, suspend_vc = -1;
int test_fd = -1;
dev_t resume_dev;
int orig_loglevel, orig_swappiness, ret;
- struct rlimit rlim;
+ struct rlimit rlim, rlim_saved;
static char chroot_path[MAX_STR_LEN];
my_name = basename(argv[0]);
/* Make sure the 0, 1, 2 descriptors are open before opening the
@@ -2500,19 +2499,19 @@ int main(int argc, char *argv[])
goto Restore_console;
}
splash.progress(5);
+#ifdef CONFIG_ENCRYPT
+ if (do_encrypt && ! use_RSA)
+ splash.read_password(password, 1);
+#endif
#ifdef CONFIG_BOTH
/* If s2ram_hacks returns != 0, better not try to suspend to RAM */
if (s2ram)
s2ram = !s2ram_hacks();
#endif
-#ifdef CONFIG_ENCRYPT
- if (do_encrypt && ! use_RSA)
- splash.read_password(password, 1);
-#endif
open_printk();
orig_loglevel = get_kernel_console_loglevel();
set_kernel_console_loglevel(suspend_loglevel);
@@ -2522,18 +2521,25 @@ int main(int argc, char *argv[])
sync();
splash.progress(10);
+ getrlimit(RLIMIT_NOFILE, &rlim_saved);
rlim.rlim_cur = 0;
rlim.rlim_max = 0;
setrlimit(RLIMIT_NOFILE, &rlim);
setrlimit(RLIMIT_NPROC, &rlim);
setrlimit(RLIMIT_CORE, &rlim);
ret = suspend_system(snapshot_fd, resume_fd, test_fd);
+ setrlimit(RLIMIT_NOFILE, &rlim_saved);
+#ifdef CONFIG_BOTH
+ if (s2ram)
+ s2ram_resume();
+#endif
+
if (orig_loglevel >= 0)
set_kernel_console_loglevel(orig_loglevel);
close_printk();
@@ -0,0 +1,48 @@
Index: b/keygen.c
===================================================================
--- a/keygen.c
+++ b/keygen.c
@@ -25,11 +25,11 @@
#define MIN_KEY_BITS 1024
#define MAX_KEY_BITS 4096
#define MAX_OUT_SIZE (sizeof(struct RSA_data))
#define MAX_STR_LEN 256
-#define DEFAULT_FILE "suspend.key"
+#define DEFAULT_FILE "/etc/suspend.key"
static char in_buffer[MAX_STR_LEN];
static char pass_buf[MAX_STR_LEN];
static struct RSA_data rsa;
static unsigned char encrypt_buffer[RSA_DATA_SIZE];
@@ -40,11 +40,11 @@ int main(int argc, char *argv[])
gcry_ac_handle_t rsa_hd;
gcry_ac_key_t rsa_priv;
gcry_ac_key_pair_t rsa_key_pair;
gcry_mpi_t mpi;
size_t offset;
- int len = MIN_KEY_BITS, ret = EXIT_SUCCESS;
+ int len = 2048, ret = EXIT_SUCCESS;
struct termios termios;
char *vrfy_buf;
struct md5_ctx ctx;
unsigned char key_buf[PK_KEY_SIZE];
gcry_cipher_hd_t sym_hd;
@@ -197,12 +197,15 @@ Retry:
gcry_free(str);
}
size = offset + sizeof(struct RSA_data) - RSA_DATA_SIZE;
- printf("File name [%s]: ", DEFAULT_FILE);
- fgets(in_buffer, MAX_STR_LEN, stdin);
+ *in_buffer = 0;
+ if (!((argc > 1) && (strcmp(argv[1], "-q") == 0))) {
+ printf("File name [%s]: ", DEFAULT_FILE);
+ fgets(in_buffer, MAX_STR_LEN, stdin);
+ }
if (!strlen(in_buffer) || *in_buffer == '\n')
strcpy(in_buffer, DEFAULT_FILE);
else if (in_buffer[strlen(in_buffer)-1] == '\n')
in_buffer[strlen(in_buffer)-1] = '\0';
fd = open(in_buffer, O_RDWR | O_CREAT | O_TRUNC, 00600);
@@ -0,0 +1,102 @@
Index: s2ram-x86.c
===================================================================
--- s2ram-x86.c.orig
+++ s2ram-x86.c
@@ -321,6 +321,7 @@ int s2ram_do(void)
void s2ram_resume(void)
{
+ int i = 0;
if (flags & PCI_SAVE) {
printf("restoring PCI config of device %02x:%02x.%d\n",
vga_dev.bus, vga_dev.dev, vga_dev.func);
@@ -330,19 +331,36 @@ void s2ram_resume(void)
}
// FIXME: can we call vbetool_init() multiple times without cleaning up?
if (flags & VBE_POST) {
- vbetool_init();
- printf("Calling do_post\n");
- do_post();
+ while (i++ < 5) {
+ vbetool_init();
+ printf("Calling do_post\n");
+ if (!do_post())
+ break;
+ printf("do_post failed, sleeping 100ms and retrying...\n");
+ usleep(100000);
+ }
+ i = 0;
}
if (vbe_buffer) {
- vbetool_init();
- printf("Calling restore_state_from\n");
- restore_state_from(vbe_buffer);
+ while (i++ < 5) {
+ vbetool_init();
+ printf("Calling restore_state_from\n");
+ if (!restore_state_from(vbe_buffer))
+ break;
+ printf("restore_state_from failed, sleeping 100ms and retrying...\n");
+ usleep(100000);
+ }
+ i = 0;
}
if (vbe_mode >= 0) {
- vbetool_init();
- printf("Calling set_vbe_mode\n");
- do_set_mode(vbe_mode, 0);
+ while (i++ < 5) {
+ vbetool_init();
+ printf("Calling set_vbe_mode\n");
+ if (!do_set_mode(vbe_mode, 0))
+ break;
+ printf("set_vbe_mode failed, sleeping 100ms and retrying...\n");
+ usleep(100000);
+ }
}
if (!fb_nosuspend)
resume_fbcon();
Index: vbetool/vbetool.c
===================================================================
--- vbetool/vbetool.c.orig
+++ vbetool/vbetool.c
@@ -231,9 +231,10 @@ int do_post(void)
return 0;
}
-void restore_state_from(char *data)
+int restore_state_from(char *data)
{
struct LRMI_regs r;
+ int ret = 1;
/* VGA BIOS mode 3 is text mode */
do_set_mode(3,1);
@@ -252,12 +253,16 @@ void restore_state_from(char *data)
"Can't restore video state (vm86 failure)\n");
} else if ((r.eax & 0xffff) != 0x4f) {
fprintf(stderr, "Restore video state failed\n");
+ } else {
+ /* everything ok */
+ ret = 0;
}
LRMI_free_real(data);
ioctl(0, KDSETMODE, KD_TEXT);
+ return ret;
}
#ifndef S2RAM
Index: vbetool/vbetool.h
===================================================================
--- vbetool/vbetool.h.orig
+++ vbetool/vbetool.h
@@ -18,5 +18,5 @@ int disable_vga(void);
int do_get_panel_id();
void vbetool_init(void);
char *__save_state(int *);
-void restore_state_from(char *);
+int restore_state_from(char *);
int __get_mode(void);
@@ -0,0 +1,71 @@
Index: b/conf/suspend.conf
===================================================================
--- a/conf/suspend.conf
+++ b/conf/suspend.conf
@@ -1,9 +1,62 @@
-snapshot device = /dev/snapshot
-resume device = <path_to_resume_device_file>
+#############################################################################
+##
+## note:
+## using pm-utils or powersaved, this file (/etc/suspend.conf) only serves as
+## a template, image_size and resume_device are filled in dynamically
+## and the generated /var/lib/s2disk.conf is used to suspend.
+## _If_ you enter stuff here, it will be copied to that file unchanged,
+## but this might skip some features and sanity checks.
+##
+#############################################################################
+##
+## your snapshot device. You should not need to change this.
+# snapshot device = /dev/snapshot
+#
+## enter your swap device here. Read the warning on pm-utils above, please!
+#resume device = <path_to_resume_device_file>
+#
+## image size will also be filled in by pm-utils
#image size = 350000000
+#
#suspend loglevel = 2
+#max loglevel =
+#
+## compute checksum will slow down suspend and resume.
+## Debugging option, default n
#compute checksum = y
-#compress = y
+#
+## compression will often speed up suspend and resume (default n)
+#compress = n
+#
+## encryption support is rather basic right now - e.g. USB keyboards will not
+## work to enter the key in the standard initrd, also beware of
+## non-US keyboard layouts. Only use this if you know what you are doing.
#encrypt = y
-#early writeout = y
+#
+## RSA key file that is used for encryption
+#RSA key file = /etc/suspend.key
+#
+## start writing out the image early, before buffers are full.
+## will most of the time speed up overall writing time (default y)
+#early writeout = n
+#
+## use splash picture? (default n)
#splash = y
+#
+## shutdown method:
+## platform - go through ACPI BIOS to power off the machine (default on
+## machines that support it)
+## shutdown - just power off like after a shutdown
+## reboot - reboot instead of powering off. For debugging only.
+#shutdown method = platform
+#
+## resume offset: for use with swapfiles, use "swap-offset" to find out.
+#resume offset = 12345
+#
+## pause after resume for n seconds, so that the timing information can
+## actually be read (default 0 => don't pause)
+#resume pause = 2
+#
+## use threads for suspend? (default n)
+## this hugely speeds up encryption and also compression on mulitcore machines
+#threads = y
@@ -0,0 +1,39 @@
Index: suspend.c
===================================================================
--- suspend.c.orig
+++ suspend.c
@@ -1768,13 +1768,15 @@ int main(int argc, char *argv[])
if (compute_checksum != 'y' && compute_checksum != 'Y')
compute_checksum = 0;
#ifdef CONFIG_COMPRESS
- if (do_compress != 'y' && do_compress != 'Y') {
+ if (do_compress != 'n' && do_compress != 'N') {
+ do_compress = 1;
+ if (lzo_init() != LZO_E_OK) {
+ suspend_error("Failed to initialize LZO. "
+ "Compression disabled.\n");
+ do_compress = 0;
+ }
+ } else
do_compress = 0;
- } else if (lzo_init() != LZO_E_OK) {
- suspend_error("Failed to initialize LZO. "
- "Compression disabled.\n");
- do_compress = 0;
- }
#endif
#ifdef CONFIG_ENCRYPT
if (do_encrypt != 'y' && do_encrypt != 'Y')
Index: conf/suspend.conf
===================================================================
--- conf/suspend.conf.orig
+++ conf/suspend.conf
@@ -25,7 +25,7 @@
## Debugging option, default n
#compute checksum = y
#
-## compression will often speed up suspend and resume (default n)
+## compression will often speed up suspend and resume (default y)
#compress = n
#
## encryption support is rather basic right now - e.g. USB keyboards will not
@@ -0,0 +1,49 @@
Index: resume.c
===================================================================
--- resume.c.orig
+++ resume.c
@@ -421,10 +421,10 @@ int main(int argc, char *argv[])
if (error)
return -error;
- if (splash_param != 'y' && splash_param != 'Y')
- splash_param = 0;
- else
+ if (splash_param != 'n' && splash_param != 'N')
splash_param = SPL_RESUME;
+ else
+ splash_param = 0;
get_page_and_buffer_sizes();
Index: suspend.c
===================================================================
--- suspend.c.orig
+++ suspend.c
@@ -1782,10 +1782,10 @@ int main(int argc, char *argv[])
if (do_encrypt != 'y' && do_encrypt != 'Y')
do_encrypt = 0;
#endif
- if (splash_param != 'y' && splash_param != 'Y')
- splash_param = 0;
- else
+ if (splash_param != 'n' && splash_param != 'N')
splash_param = SPL_SUSPEND;
+ else
+ splash_param = 0;
if (early_writeout != 'n' && early_writeout != 'N')
early_writeout = 1;
Index: conf/suspend.conf
===================================================================
--- conf/suspend.conf.orig
+++ conf/suspend.conf
@@ -40,7 +40,7 @@
## will most of the time speed up overall writing time (default y)
#early writeout = n
#
-## use splash picture? (default n)
+## use splash picture? (default y)
#splash = y
#
## shutdown method:
@@ -0,0 +1,76 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>suspend</Name>
<Homepage>http://suspend.sourceforge.net/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>GPLv2</License>
<IsA>app:console</IsA>
<Summary>A set of tools to support sleep modes</Summary>
<Description>suspend package allows users to suspend-to-ram, suspend-to-disk, and suspend-to-both.</Description>
<Archive sha1sum="49ac219b54780265c31e8263d00e2b7b525d0736" type="tarbz2">http://sourceforge.net/projects/suspend/files/suspend/suspend-1.0/suspend-utils-1.0.tar.bz2</Archive>
<BuildDependencies>
<Dependency>lzo-devel</Dependency>
<Dependency>pciutils-devel</Dependency>
<Dependency>libx86-devel</Dependency>
<Dependency>plymouth-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">suse/suspend-comment-configfile-options.diff</Patch>
<Patch level="0">suse/suspend-default-compress.diff</Patch>
<Patch level="0">suse/suspend-default-splash.diff</Patch>
<Patch level="1">suse/suspend-0.80-dont-return-eintr-on-abort.diff</Patch>
<!--Patch level="1">suse/suspend-0.80-fix-s2both-resume-hacks.diff</Patch-->
<Patch level="1">suse/suspend-0.80-keygen-new-defaults.diff</Patch>
<Patch level="0">suse/suspend-0.80-vbetool-retry-on-errors.diff</Patch>
<Patch level="1">mandriva/suspend-0.8-printf_format.patch</Patch>
<!--<Patch level="1">mandriva/suspend-plymouth.patch</Patch>-->
<!--<Patch level="1">mandriva/suspend-plymouth-always-quit.patch</Patch>-->
<Patch level="1">resume-dont-ask-questions.patch</Patch>
<Patch level="1">suppress-outputs.patch</Patch>
<!--<Patch level="1">improve-plymouth-support.patch</Patch>-->
</Patches>
</Source>
<Package>
<Name>suspend</Name>
<RuntimeDependencies>
<Dependency>lzo</Dependency>
<Dependency>libx86</Dependency>
<Dependency>plymouth-core-libs</Dependency>
<Dependency>pciutils</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="config">/etc/suspend.conf</Path>
<Path fileType="config">/etc/suspend.key</Path>
<Path fileType="executable">/usr/sbin</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
<AdditionalFiles>
<AdditionalFile owner="root" permission="0755" target="/usr/sbin/configure-suspend-encryption">suse/configure-suspend-encryption.sh</AdditionalFile>
</AdditionalFiles>
</Package>
<History>
<Update release="2">
<Date>2014-03-09</Date>
<Version>1.0</Version>
<Comment>Rebuild</Comment>
<Name>Varol Maksutoğlu</Name>
<Email>waroi@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2012-12-29</Date>
<Version>1.0</Version>
<Comment>First release</Comment>
<Name>Osman Erkan</Name>
<Email>osman.erkan@pisilinux.org</Email>
</Update>
</History>
</PISI>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>suspend</Name>
<Summary xml:lang="tr">Uyku kiplerini destekleme araçları</Summary>
<Description xml:lang="tr">suspend, kullanıcıların bellek, disk veya her ikisini de kullanarak sistemlerini askıya almalarını sağlayan araçları içerir.</Description>
</Source>
</PISI>