Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
1
Konular (issue)
1
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
inary
Commits
87c87b7a
Unverified
Kaydet (Commit)
87c87b7a
authored
Haz 11, 2020
tarafından
Suleyman Poyraz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
inary-sandbox oluşturuldu.
üst
c3c4c9cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
inary-sandbox
scripts/inary-sandbox
+93
-0
No files found.
scripts/inary-sandbox
0 → 100755
Dosyayı görüntüle @
87c87b7a
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Main fork Pisi: Copyright (C) 2005 - 2011, Tubitak/UEKAE
#
# Copyright (C) 2018, Suleyman POYRAZ (Zaryob)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. Please read the COPYING file.
#
import
os
import
shutil
import
subprocess
import
sys
import
stat
import
time
import
socket
import
getopt
# run command and terminate if something goes wrong
def
run
(
cmd
,
ignore_error
=
False
):
print
(
cmd
)
ret
=
os
.
system
(
cmd
)
if
ret
and
not
ignore_error
:
print
((
"
%
s returned
%
s"
%
(
cmd
,
ret
)))
sys
.
exit
(
1
)
def
create_sandbox
(
output_dir
,
repository
):
try
:
# Add repository of the packages
run
(
'inary --yes-all --destdir="
%
s" add-repo pardus
%
s'
%
(
output_dir
,
repository
))
# Install system.base and system.devel
run
(
'inary --yes-all --ignore-file-conflicts -D"
%
s" it -c system.base -c system.devel'
%
output_dir
)
# Create /etc from baselayout
path
=
"
%
s/usr/share/baselayout/"
%
output_dir
path2
=
"
%
s/etc"
%
output_dir
for
name
in
os
.
listdir
(
path
):
run
(
'cp -p "
%
s" "
%
s"'
%
(
os
.
path
.
join
(
path
,
name
),
os
.
path
.
join
(
path2
,
name
)))
# Create character device
os
.
mknod
(
"
%
s/dev/null"
%
output_dir
,
0
o666
|
stat
.
S_IFCHR
,
os
.
makedev
(
1
,
3
))
os
.
mknod
(
"
%
s/dev/console"
%
output_dir
,
0
o666
|
stat
.
S_IFCHR
,
os
.
makedev
(
5
,
1
))
# Create urandom character device
os
.
mknod
(
"
%
s/dev/urandom"
%
output_dir
,
0
o666
|
stat
.
S_IFCHR
,
os
.
makedev
(
1
,
9
))
# run command in chroot
def
chrun
(
cmd
):
run
(
'chroot "
%
s"
%
s'
%
(
output_dir
,
cmd
))
chrun
(
"/sbin/ldconfig"
)
chrun
(
"/sbin/update-environment"
)
chrun
(
"/usr/bin/inary cp baselayout"
)
chrun
(
"/usr/bin/inary cp"
)
file
(
os
.
path
.
join
(
output_dir
,
"etc/sulin-release"
),
"w"
)
.
write
(
"Sulin 2020
\n
"
)
except
KeyboardInterrupt
:
run
(
'umount
%
s/proc'
%
output_dir
,
ignore_error
=
True
)
run
(
'umount
%
s/sys'
%
output_dir
,
ignore_error
=
True
)
sys
.
exit
(
1
)
def
mount_sandbox
():
run
(
"mkdir -p tmpfs"
)
run
(
"mount -t tmpfs -o size=1024M,mode=0744 tmpfs tmpfs/"
)
run
(
"mkdir -p sandbox"
)
run
(
"mount -t aufs -o br=tmpfs=rw:base=ro none sandbox/"
)
run
(
'/bin/mount --bind /proc sandbox/proc'
)
run
(
'/bin/mount --bind /dev sandbox/dev'
)
def
umount_sandbox
():
run
(
'/bin/umount sandbox/dev'
)
run
(
'/bin/umount sandbox/proc'
)
run
(
'/bin/umount sandbox'
)
run
(
'/bin/umount tmpfs'
)
cmd
=
sys
.
argv
[
1
]
if
cmd
==
"create"
:
create_sandbox
(
"base"
,
"https://master.dl.sourceforge.net/project/sulinos/SulinRepository/inary-index.xml"
)
elif
cmd
==
"reset"
:
umount_sandbox
()
elif
cmd
==
"build"
:
pspec
=
sys
.
argv
[
2
]
mount_sandbox
()
run
(
'chroot sandbox inary build
%
s'
%
pspec
)
umount_sandbox
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment