LinHES Forums http://forum.linhes.org/ |
|
Accidently wiped out /usr/local/bin http://forum.linhes.org/viewtopic.php?f=6&t=8697 |
Page 1 of 1 |
Author: | mihanson [ Sat Feb 25, 2006 3:00 am ] |
Post subject: | Accidently wiped out /usr/local/bin |
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? |
Author: | marc.aronson [ Sat Feb 25, 2006 8:37 am ] |
Post subject: | |
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 |
Author: | tjc [ Sat Feb 25, 2006 9:40 am ] |
Post subject: | |
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. |
Author: | mihanson [ Sat Feb 25, 2006 2:02 pm ] |
Post subject: | |
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! ![]() |
Author: | tjc [ Tue Dec 18, 2007 8:28 pm ] |
Post subject: | |
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. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |