From: "Денис Смирнов" <mithraen@freesource.info>
To: sisyphus@lists.altlinux.org
Subject: Re: [sisyphus] Текстовый инсталлер
Date: Sat, 4 Aug 2012 17:05:43 +0400
Message-ID: <20120804130543.GA9211@mw.mithraen.ru> (raw)
In-Reply-To: <CAC4WpAz7gm=afum=oOEATRPmp195=kxj+qTNdtPPpt6JHpLdWw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 711 bytes --]
On Sat, Aug 04, 2012 at 03:03:15PM +0300, Dmitriy Kruglikov wrote:
DK> Давай делать эскалацию проблемы...
DK> Если нет возможности паковать/распаковывать хард-динки, значить их
DK> паковать и не нужно...
DK> Давай их _делать_ после распаковки.
DK> Или при первом старте ...
То есть, нужно два скрипта.
первый:
- выявит все хардлинки
- удалит их
- положит их список куда-нибудь
второй:
- пересоздаст после распаковки
Мне все-таки больше нравится вариант с патченым cpio.
В аттаче мой патч, который я писал в ноябре 2006. Это демо, но оно успешно
работало.
--
С уважением, Денис
http://mithraen.ru/
----------------------------------------------------------------------------
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: cpio-2.6-can-break-hardlinks.patch --]
[-- Type: text/x-patch; charset=utf-8, Size: 1900 bytes --]
ôÏÌØËÏ × cpio-2.6/rmt: rmt
ôÏÌØËÏ × cpio-2.6/rmt: rmt.o
ôÏÌØËÏ × cpio-2.6/src: copyin.o
ôÏÌØËÏ × cpio-2.6/src: copyout.o
diff -ur cpio-2.6.orig/src/copypass.c cpio-2.6/src/copypass.c
--- cpio-2.6.orig/src/copypass.c 2006-10-01 00:14:55 +0400
+++ cpio-2.6/src/copypass.c 2006-10-01 00:18:13 +0400
@@ -29,6 +29,46 @@
#define lchown chown
#endif
+/* Copy file */
+int copy_file(const char *infile, const char *outfile)
+{
+ int ifd, ofd, len;
+ struct stat in_stat;
+ mode_t oldmode;
+ char buf[4096]; /* XXX make it lerger. */
+ if ((ifd = open(infile, O_RDONLY)) < 0) {
+ return -1;
+ }
+ fstat(ifd, &in_stat);
+ oldmode = umask(0);
+ if ((ofd = open(outfile, O_WRONLY | O_TRUNC | O_CREAT, 07777 & in_stat.st_mode )) < 0) {
+ close(ifd);
+ umask(oldmode);
+ return -1;
+ }
+ fchown(ofd, in_stat.st_uid, in_stat.st_gid);
+ umask(oldmode);
+ while ((len = read(ifd, buf, sizeof(buf)))) {
+ int res;
+ if (len < 0) {
+ break;
+ }
+ /* XXX handle partial writes */
+ res = write(ofd, buf, len);
+ if (res != len) {
+ len = -1; /* error marker */
+ break;
+ }
+ }
+ close(ifd);
+ close(ofd);
+ if (len < 0) {
+ unlink(outfile);
+ return -1; /* error */
+ }
+ return 0; /* success */
+}
+
/* Copy files listed on the standard input into directory `directory_name'.
If `link_flag', link instead of copying. */
@@ -455,6 +495,8 @@
link_to_name (char *link_name, char *link_target)
{
int res = link (link_target, link_name);
+ if (res < 0)
+ copy_file(link_target, link_name);
if (res < 0 && create_dir_flag)
{
create_all_directories (link_name);
@@ -470,6 +512,10 @@
{
error (0, errno, _("cannot link %s to %s"),
link_target, link_name);
+ res = copy_file(link_target, link_name);
+ if (res)
+ strerror("copy_file");
}
return res;
}
+
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-08-04 13:05 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 6:51 Eugene Prokopiev
2012-07-30 6:55 ` Dmitriy Kruglikov
2012-07-30 11:18 ` Денис Смирнов
2012-07-30 14:32 ` Dmitriy Kruglikov
2012-07-30 14:46 ` Michael Shigorin
2012-07-30 18:41 ` Michael Shigorin
2012-07-30 22:19 ` Денис Смирнов
2012-07-31 16:05 ` Michael Shigorin
2012-08-01 10:12 ` Денис Смирнов
2012-08-01 11:11 ` Michael Shigorin
2012-08-01 12:34 ` Денис Смирнов
2012-08-01 20:01 ` Michael Shigorin
2012-08-01 21:10 ` Денис Смирнов
2012-07-31 0:41 ` Денис Смирнов
2012-07-31 15:44 ` [sisyphus] [JT] rpm2cpio.sh (was: Текстовый инсталлер) Michael Shigorin
2012-08-01 10:01 ` Денис Смирнов
2012-08-01 10:20 ` [sisyphus] [JT] rpm2cpio.sh Денис Смирнов
2012-07-31 18:31 ` [sisyphus] Текстовый инсталлер Michael A. Kangin
2012-08-01 9:59 ` Денис Смирнов
2012-08-01 11:06 ` Michael Shigorin
2012-08-01 11:44 ` Michael A. Kangin
2012-08-01 19:54 ` Michael Shigorin
2012-08-01 20:58 ` Денис Смирнов
2012-08-01 12:08 ` Денис Смирнов
2012-08-01 12:13 ` Dmitriy Kruglikov
2012-08-01 12:28 ` Денис Смирнов
2012-08-01 12:11 ` Денис Смирнов
2012-08-01 15:03 ` Anton V. Boyarshinov
2012-08-01 17:22 ` Денис Смирнов
2012-08-01 17:27 ` Денис Смирнов
2012-07-31 6:23 ` Dmitriy Kruglikov
2012-07-31 7:36 ` Michael Bochkaryov
2012-07-31 10:33 ` Денис Смирнов
2012-07-31 10:38 ` Michael Bochkaryov
2012-08-04 9:35 ` Денис Смирнов
2012-08-04 12:03 ` Dmitriy Kruglikov
2012-08-04 13:05 ` Денис Смирнов [this message]
2012-07-31 10:38 ` Dmitriy Kruglikov
2012-07-31 13:05 ` Денис Смирнов
2012-07-31 10:34 ` Денис Смирнов
2012-07-30 22:15 ` Денис Смирнов
2012-07-31 15:20 ` Michael Shigorin
2012-08-01 9:57 ` Денис Смирнов
2012-08-01 11:21 ` Michael Shigorin
2012-08-01 12:39 ` Денис Смирнов
2012-08-01 13:11 ` Alexey Gladkov
2012-08-01 13:36 ` Dmitriy Kruglikov
2012-08-01 20:28 ` Alexey Gladkov
2012-08-01 21:13 ` Денис Смирнов
2012-08-02 10:56 ` Michael Shigorin
2012-08-02 6:36 ` Michael A. Kangin
2012-08-04 9:38 ` Денис Смирнов
2012-07-30 22:21 ` Денис Смирнов
2012-07-31 4:09 ` Eugene Prokopiev
2012-07-31 10:13 ` Денис Смирнов
2012-07-31 10:33 ` Dmitriy Kruglikov
2012-07-31 10:44 ` Денис Смирнов
2012-07-31 10:52 ` Aleksey Novodvorsky
2012-07-31 11:02 ` Dmitriy Kruglikov
2012-07-31 13:03 ` Денис Смирнов
2012-07-31 4:03 ` Eugene Prokopiev
2012-07-31 8:51 ` Michael Bochkaryov
2012-07-31 13:07 ` Денис Смирнов
2012-07-31 15:15 ` Dmitriy Kruglikov
2012-08-01 9:52 ` Денис Смирнов
2012-07-31 16:09 ` Michael Shigorin
2012-08-01 10:26 ` Денис Смирнов
2012-08-01 11:13 ` Michael Shigorin
2012-08-01 10:25 ` Денис Смирнов
2012-07-31 10:10 ` Денис Смирнов
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120804130543.GA9211@mw.mithraen.ru \
--to=mithraen@freesource.info \
--cc=sisyphus@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git