Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Sunday, July 06, 2008

Configuring APT

I've been using APT for the past couple of years to update my Fedora system from releases 5 to 9.

There is always this $(VERSION) variable that I did not know how to set. Recently, apt-get update has been failing to get some repomd (repository meta-data) files, and I realized the $(VERSION) was expanding to 9.90.

Of course the repositories did not have a directory called 9.90, there was 7, 8, 9, but no decimals.

Getting off my lazy bum to do some research at long last (I was replacing $(VERSION) with 9 manually), I found http://apt-rpm.org/options.shtml which documented two variables in the APT:: namespace - DistroVersion and DistroVerPkg.

In the first place, this information should have been more up-front and visible in the documentation. Googling "apt-get $(VERSION)" didn't turn up any good hits at all.

DistroVerPkg is the default value for deriving $(VERSION), and it has a value of "fedora-release" (/etc/fedora-release). This file looks like this:
Fedora release 9.90.1 (Rawhide)
This causes $(VERSION) to expand by default to 9.90, since DistroVersion is not defined.

Hence, in my /etc/apt.conf, I've added the following line:

APT::DistroVersion "9";

which expands $(VERSION) to the correct value.

Sunday, July 29, 2007

My Linux System

I've upgraded my Linux system from Fedora Core 5 to Fedora 7 overnight with the help of the Internet and apt-get. Just one night with apt-get has made me abandon YUM. Now my system is spanking new, and the install/upgrade process also tidied up my system files in the process! E.g. /etc/fstab, /etc/modprobe.conf, /etc/grub.conf, etc.

1. Asus Pundit-R
2. Intel P4 3.0GHz Hyper-Threading
3. 512MB DDR SDRAM
4. 60GB Western Digital (IDE, 8MB cache, 3.5")
5. Samsung 40x CD-RW (IDE)
6. Fedora 7 (2.6.21-1.3228.fc7)

Here are some of my prevous computer related posts that I put in another blog. I'll just move them here for consistency sake.

Motive Certification



TR-069: DSL1000EU is Motive Baseline Certified Just received confirmation that our DSL1000EU has been Motive certified. Next step is to get DSL605EW the same certification as well. SSL verification need to be done properly.Hoping to get Siemens verification behind us - hope to do so next week.

DSL605EW is Motive certified. 'Nuff said.


A PUT script in Python+Apache



I finally managed to write a PUT script properly.

Initially I thought it was simply reading the file data from stdin and writing the contents out to a filename that is retrieved from the environment. Well, it used to be that simple on Unix/Linux. On Windows it is a lot more complicated.

  1. In Windows, file streams are in TEXT mode, even stdin!
  2. To fix this, "import msvcrt", msvcrt(sys.stdin.fileno(), os.O_BINARY)
  3. How do you know you are running Windows?
  4. "if sys.platform=='win32':"


Here is the code in all its glory:


#!"C:\Python24\Python.exe"
import os, sys, time
if sys.platform=='win32': import msvcrt

apacheHelp = '''This directive adds an action, which will activate cgi-script when a file is requested using the method of method. The cgi-script is the URL-path to a resource that has been designated as a CGI script using ScriptAlias or AddHandler. The URL and file path of the requested document is sent using the standard CGI PATH_INFO and PATH_TRANSLATED environment variables.'''
def reportError(errMsg):
print 'Content-Type: text/plain\r\n\r\n'
print errMsg

def debugEnv():
print 'Content-Type: text/plain\r\n\r\n'
for x in os.environ.keys():
print x,'=',os.environ[x]

def getenv(name):
try:
return os.environ[name]
except KeyError:
return ''

def writeFile(path, srcFD):
dstFD = open(path, 'wb')
numWrite = 0
while True:
buf = srcFD.read(1024)
if len(buf)==0: break
dstFD.write(buf)
dstFD.flush()
numWrite += len(buf)
dstFD.close()
return numWrite

# debugEnv()
def main():
pathInfo = getenv('PATH_INFO')
if (not pathInfo.startswith('/uploads/')):
reportError('Disallowed upload path ' + pathInfo)
sys.exit(1)
if pathInfo.endswith('/'):
reportError('Cannot upload file as a directory!')
sys.exit(2)

if sys.platform=='win32': msvcrt.setmode(sys.stdin.fileno(), (os.O_BINARY))
size = writeFile(getenv('PATH_TRANSLATED'), sys.stdin)

reportError('')
print '%d bytes written to %s\n' % (size, pathInfo)

if '__main__'==__name__:
main()



Rare error on Google?