View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 5 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat Feb 25, 2006 3:00 am 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
I accidently deleted everything in my /usr/local/bin directory. Is there anyway to get the contents that KnoppMyth installed in that directory back? If so, what do I need to do?

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 25, 2006 8:37 am 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
Two thoughts off the top of my head:

1. If you have a spare drive, you could install a fresh version of knoppmyth on that drive and then copy over the "/usr/local/bin" directory from that drive to your original drive. If you need directions on how to do this, let me know and I'll post some steps for you.

2. I've created a compressed tar file of my /usr/local/bin -- it's ~6MB. It's from version R5A30.2. I can email it to you if you send me your email address. A few caveats: Some emailers won't accept files this large; I don't know if any of the content of /usr/local/bin is "machine specific"; I've tweaked some of the scripts including "mythbackup" and "mythlink.sh".

3. Run a mythbackup and then do an autoupgrade of your machine. This will re-install everything, including /usr/local/bin, but the backup will be used to restore your data base and config changes you've made. I've pasted a copy of mythbackup below since your copy was wiped with the loss of /usr/local/bin.

Marc

Code:
#!/bin/bash
#       /usr/local/bin/mythbackup
########################################################################
DATABASE="mythconverg"
BK_DIR="/myth/backup"
BK_SQL="$DATABASE.sql"
BK_ETC="etc.tar"
BK_LBIN="lbin.tar"
BK_HME="home.tar"
BK_GOD="root.tgz"
SOUNDS="/usr/share/sounds"
########################################################################
[ -d "$BK_DIR" ] || exit 1
#
# Play a sound to let you know I'm starting.
 (play $SOUNDS/beg.wav >& /dev/null)&
 cd /
# Check and fix mythconverg db to ensure clean copy
cd /var/lib/mysql/mythconverg
/etc/init.d/mythtv-backend stop
/etc/init.d/mysql stop
myisamchk -f *.MYI
/etc/init.d/mysql start
/etc/init.d/mythtv-backend start
cd /
#
# back up the old back, if present:
 [ -f "$BK_DIR/$BK_SQL" ] && mv -f $BK_DIR/$BK_SQL $BK_DIR/${BK_SQL}.bak
# Dumps the $DATABASE database
 mysqldump -u root $DATABASE -c > $BK_DIR/$BK_SQL
# Tars newer part of /etc
 [ -f "$BK_DIR/$BK_ETC" ] && mv -f $BK_DIR/$BK_ETC $BK_DIR/${BK_ETC}.bak
 find ./etc ! -type d -newer /etc/.epoch -print0 | xargs -0 tar -uf $BK_DIR/$BK_ETC
 [ -f "$BK_DIR/$BK_ETC" ] && gzip -9 $BK_DIR/$BK_ETC
# Tars newer part of /home
 [ -f "$BK_DIR/$BK_HME" ] && mv -f $BK_DIR/$BK_HME $BK_DIR/${BK_HME}.bak
 find ./home ! -type d -newer /home/.epoch -print0 | xargs -0 tar -uf $BK_DIR/$BK_HME
 [ -f "$BK_DIR/$BK_HME" ] && gzip -9 $BK_DIR/$BK_HME
# Tars all of /root
 [ -f "$BK_DIR/$BK_GOD" ] && mv -f $BK_DIR/$BK_GOD $BK_DIR/${BK_GOD}.bak
 tar czf $BK_DIR/$BK_GOD ./root
 chmod 740 $BK_DIR/$BK_GOD
# Tars /home/mythtv/.mythtv and a few others
tar -cjpf /myth/backup/mythtv.tar.bz2 /home/mythtv/ /etc/mythtv/modules
# Play a sound to let you know I'm done.
 (play $SOUNDS/end.wav >& /dev/null)&
#
exit 0
########################################################################
# End


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 25, 2006 9:40 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Hope this gets to you in time. There is a much simpler solution.

- Boot from the CD as usual, but take option 6 (Exit) from the menu. This wil ask for confirmation then drop you to a command prompt.

- Type mount /dev/hda1 and hit enter. You can now access your root partition on /mnt/hda1.

- Type mkdir -p /mnt/hda1/usr/local/bin and hit enter. This will ensure that the destination directory exists.

- Type (cd /usr/local/bin ; tar cf - .) | (cd /mnt/hda1/usr/local/bin ; tar xvf -) and hit enter. Pay special attention to make sure you have this command exactly right. All the "punctuation" there matters. You can also use a recursive cp or rysnc command with the appropriate "archive" mode options that preserve ownership, permissions and datestamps. I've just been using the "tar trick" for so long that it's reflex by now.

That should restore the contents of that directory. Note that this is a general technique and will work for most files which come from the CD image.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 25, 2006 2:02 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
tjc,
You were in time and it solved the problem. The only tweak I had to make was substitute sda1 for hda1 as I'm using a serial ata hard drive. I love this forum!
:D

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 18, 2007 8:28 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Just a follow on note for archival purposes.

You can also mount the CD as described on this wiki page: http://www.knoppmythwiki.org/index.php?page=MountImage This is a very useful and general technique to know, and it's dead easy.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 31 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu