The The Dark Star
An everyday OS.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   fchat fChat   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tds_hdinstall source

 
Post new topic   Reply to topic    The Dark Star Forum Index -> За програмисти
View previous topic :: View next topic  
Author Message
InFeRnODeMoN
Ultra God Master King


Joined: 11 May 2006
Posts: 159

PostPosted: Sat Aug 19, 2006 8:22 am    Post subject: tds_hdinstall source Reply with quote

Ето и кода на The Dark Star Setup (tds_hdinstall)

Code:
#!/bin/sh
# System Installer Script
# By Pavel Dikov, under the Patatos Software License

# Totally pointless, but in theory this should help. Should.
WHOS_DA_BOSS=$$

# Hahaha! Not installing as root!
if [ $(whoami) != root ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "You must run this as root." 5 45
   exit 1
fi

# The user should know that this installer can make a grown man cry like a 3
# years old little girl, whose big brother just catapulted Barbie over the fence.
Xdialog --title "The Dark Star Setup"
   --yesno "ABANDON ALL HOPE, YE WHO ENTER HERE!

Welcome to The Dark Star Setup.
Please bear in mind that this Setup is
EXPERIMENTAL, and unless you really are
prepared to restore any damaged system
or your disk drives' data is worthless
to you, we strongly advise you to quit.
We can not be held responsible for
any damages to your hardware/software!

Proceed any further???"
   20 42 || exit 1

# Tell the user that they are going to lose the GB's of pr0n they were collecting for years...
Xdialog --title "The Dark Star Setup"
   --msgbox "Now we're going to partition your harddisk.
Harddisks in *BSD use a simple naming scheme:
IDE:  ad[0-9]
SCSI: da[0-9]
Make sure you memorize your desired partition!
Use FreeBSD Default type for your partition!

WARNING: The partitioner is kinda bad."
   14 45 || exit 1

# Slicing the Hard Disk For Dummies
xterm /usr/local/bin/hdinstall_partmgr

PART_RET=`cat /tmp/partmgr_retval`

if [ $PART_RET != 0 ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to write partition table, damnit." 5 45
   exit 1
fi

# Choosing the Hard Disk can not be made better.
# The boot manager seems to like booting from an 'a' partition only, so blocking unuseful candidates from being confusing.
cat /dev/null >/tmp/partlist.tmp.$$
for fs in `basename $(ls /dev/ad?s*a /dev/da?s*a 2>/dev/null)`
do
echo ""$fs" "Install The Dark Star in $fs" off " >>/tmp/partlist.tmp.$$
done
echo "Xdialog --title "Which one? " --radiolist "Now enter your partition to install The Dark Star on:" 24 48 0
$(cat /tmp/partlist.tmp.$$)" >/tmp/partdialog.sh.$$
eval sh /tmp/partdialog.sh.$$ 2>/tmp/setup.tmp.$$


PARTITION=`cat /tmp/setup.tmp.$$`

Xdialog --title "The Dark Star Setup"
   --yesno "The time has come.
If you are in doubt, QUIT NOW...
We can not be held responsible for
any damages to your hardware/software!
Do you want to proceed any further?"
   11 37 || exit 1

# Converting the Chosen One to FreeBSDism...
(
bsdlabel -w /dev/${PARTITION} >/dev/null 2>&1 || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to write partition label, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo "50"
newfs /dev/${PARTITION} >/dev/null 2>&1 || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to write partition FS, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo "100"
) | Xdialog --title "The Dark Star Setup" --gauge "Formatting $PARTITION as UFS..." 5 40

if [ $? = 255 ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "You have canceled Setup. Data may be lost." 5 45
   exit 1
fi

# Mount the Chosen One...
(
mkdir /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to map partition FS, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo "50"
mount /dev/${PARTITION} /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to map partition FS, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo "100"
) | Xdialog --title "The Dark Star Setup" --gauge "Mounting $PARTITION..." 5 40

if [ $? = 255 ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "You have canceled Setup. Data may be lost." 5 45
   exit 1
fi

# Then make him have a good lunch. Cholesterole included!
(
cp -R /etc /sys /var /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 12
cp -R /lib /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 25
cp -R /root /tmp /bin /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 37
cp -R /compat /libexec /sbin /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 50
cp -R /usr /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 62
cp -R /mnt/dvd/boot /mounthd 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 75
mkdir /mounthd/dev 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
mkdir /mounthd/proc 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
tar -cf - /rescue | (cd /mounthd ; tar -xpBf -)
rm -f /mounthd/etc/rc.d/thedarkstarrc 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 88
cp /mounthd/etc/thedarkstarrc.trick /mounthd/etc/rc.d 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
cp /mounthd/etc/fstab.vanilla /mounthd/etc/fstab 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
rm -f /mounthd/boot/loader.conf 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
rm -f /mounthd/boot/mfsroot.gz 2>/dev/null || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to copy files, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 100
) | Xdialog --title "The Dark Star Setup" --gauge "Copying files..." 5 40

# Please, DON'T!
if [ $? = 255 ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "You have canceled Setup. Data may be lost." 5 45
   exit 1
fi

# Very good! So, how do we boot an OS without a bootstrapper?
(
umount /mounthd 2>/dev/null || umount -f /mounthd 2>/dev/null
echo 50
bsdlabel -B /dev/${PARTITION} >/dev/null 2>&1 || (Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "FAILED to install bootstrap, damnit." 5 45 ; kill -KILL $WHOS_DA_BOSS)
echo 100
) | Xdialog --title "The Dark Star Setup" --gauge "Installing bootstrap..." 5 40

# ...you idiots, canceled the installer while making the new OS bootable.
if [ $? = 255 ] ; then
   Xdialog --title "The Dark Star Setup" --ok-label "OK" --cancel-label "No, it's NOT OK! " --yesno "You have canceled Setup. Data may be lost." 5 45
   exit 1
fi

# Alarm the user of his/her impending doom...
Xdialog --title "The Dark Star Setup"
--msgbox "Congrats, you now have The Dark Star installed!
And don't forget to bash us like mad if it
doesn't work..."
8 45


Code:
#!/bin/sh

sysinstall diskPartitionEditor || exit 1
sysinstall diskPartitionWrite

echo $? > /tmp/partmgr_retval

_________________
Pavel D. - creator of The Dark Star.



Last edited by InFeRnODeMoN on Thu Oct 12, 2006 8:14 pm; edited 4 times in total
Back to top
View user's profile Send private message Send e-mail
winboze
Administrator


Joined: 15 Jun 2006
Posts: 63

PostPosted: Sat Aug 19, 2006 7:18 pm    Post subject: Reply with quote

Една забележка. Последната кутийка трябва да е msgbox, а не yesno 8)
_________________
Simple code always works.
Back to top
View user's profile Send private message Send e-mail
InFeRnODeMoN
Ultra God Master King


Joined: 11 May 2006
Posts: 159

PostPosted: Sun Aug 20, 2006 10:05 am    Post subject: Reply with quote

Знам, тъп съм. Работата беше че го бях настроил да инсталира MBR, а пък sysinstall го можело това. И аз като махах промпта за MBR забравих да сменя yesno с msgbox...
Нищо. Не е голям дефект. Пък и не ща ПАК да buildвам 3.0, защото 5 билда за едно и също нещо (41,42,43,44,45) не искам много много.
_________________
Pavel D. - creator of The Dark Star.

Back to top
View user's profile Send private message Send e-mail
InFeRnODeMoN
Ultra God Master King


Joined: 11 May 2006
Posts: 159

PostPosted: Fri Aug 25, 2006 3:13 pm    Post subject: Reply with quote

малък ъпдейт, все пак вече поянах работа по 4.0
_________________
Pavel D. - creator of The Dark Star.

Back to top
View user's profile Send private message Send e-mail
InFeRnODeMoN
Ultra God Master King


Joined: 11 May 2006
Posts: 159

PostPosted: Thu Oct 12, 2006 8:12 pm    Post subject: Reply with quote

УЖАС!!!!!!!
Два рилийза, захабени!!

Ъпдейт с версията от 5.0. И да не пропускате коментарите.
_________________
Pavel D. - creator of The Dark Star.

Back to top
View user's profile Send private message Send e-mail
Ivo Georgiev



Joined: 11 Jul 2008
Posts: 1

PostPosted: Fri Jul 11, 2008 6:53 am    Post subject: Reply with quote

Xdialog? Това не го бях чувал Smile
Ти се гавриш с горкия скрипт Very Happy
$WHOS_DA_BOSS Very Happy
Но мисля, че има пропуски. Не е хубаво да копираш файловете, по-хубаво ги екстрактни от самото Live CD.
Не съм много запознат с Live CD-тата на BSD, но би трябвало да има squashfs image ако работят на този принцип. А, да, забравих да кажа, че отделно трябва да си копира /boot и да генерира нов fstab. Просто този начин, мисля, че е по-читав, защото юзъра може да направи някви модификации, с което инсталацията да се проваля по някаква причина. Докато с предложения от мен метод винаги ще се инсталират едни файлове, което прави вероятността за бъг по-малка.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Dark Star Forum Index -> За програмисти All times are GMT


Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum