Kickstart file inside boot_command - packer

I have the following question. I want to build a Centos 7 imagine using Packer. I want to run the template without a kickstart file .cfg due to some security issues. Is it possible to write all the commands from the kick start file to the template.json?
This is how it actually looks:
"boot_command": "<tab> inst.text inst.ks=https://raw.githubusercontent.com/xxx/xxx/xxx/centos-7.cfg <enter><wait>",
# Turning on text-mode installation (little quicker than GUI)
text
# Setting up authentication and keyboard
auth --enableshadow --passalgo=sha512
keyboard --vckeymap=us --xlayouts='us'
# Installation files source (CentOS-7.0-1406-x86_64-Minimal.iso)
cdrom
# Using only primary disk, ignoring others
ignoredisk --only-use=sda
# Setting up language to English
lang en-US.UTF-8
...
And I want something like:
text
auth --enableshadow --passalgo=sha512
keyboard --vckeymap=us --xlayouts='us'
cdrom
ignoredisk --only-use=sda
lang en-US.UTF-8"
...
Unfortunately, the virtual machine doesn't realize that I am sending these commands as kickstart commands and it starts in the GUI mode.

How is your source built?
You will need to create a boot command directive that simulates the keys so that it can start and make the ks file available for the installation (using floppy_dirs or similar)

Related

weblogic 12.2.1 config wizard C:\Program is not recognized error

Running the Config Wizard via the start menu (Windows 7) simply fails. Running it from the command prompt shows the infamous
'C:\Program' is not recognized as an internal or external command, operable program or batch file
I know this is due to the space in "Program Files" (dir C:\pro* /x doesn't show C:\Progra~1).
The solution I've found for this is to replace C:\Program Files\... with "C:\Program Files\...".
My question is this:
Since the WebLogic config wizard runs from config.cmd, which is loaded with variables for path names, do I have to update Windows system environment variable PATH and put quotes around all path names that have a space (since I don't know what WebLogic is looking for)?
Update:
I tried this and received Files was unexpected at this time. Which made me think I was off with the quotes, but they are paired properly around every path with C:\Program Files. A search on this error resulted with this advice...basically the double quotes are the cause.
If the lack of quotes causes the first problem, and the presence of quotes causes the second problem, what to do? It's a loop...
I installed another JDK in a location with no spaces (still got the error because I didn't change any environment variables because work site will change them back, breaking things).
The install docs in chapter 4 say:
To begin domain configuration, navigate to the
ORACLE_HOME/oracle_common/common/bin directory and start the
Configuration Wizard.
On UNIX operating systems:
./config.sh
On Microsoft Windows operating systems:
.\config.cmd
Which implied at a command prompt (to me anyways). I was reading another site for help and the guy said to update config.cmd to point it to new JDK location instead of JAVA_HOME.
Instead of right clicking on config.cmd to edit it I double clicked it and lo and behold...this nice domain creator GUI opened up where I could specify which JDK to use. Done! No errors...
If that little tidbit were in the docs it would've save me a lot of time and frustration. And no, I'm not a server admin type, just a dev who needed a local web server for testing purposes.
I hope this helps someone.

Simplest way to host html [duplicate]

This question already has answers here:
Best lightweight web server (only static content) for Windows [closed]
(8 answers)
Closed 8 years ago.
What is the simplest way to host an HTML page over LAN?
I literally just need to have like 5 lines of HTML, so I don't want to download and setup an Apache server. I just want to know the fastest/simplest way to do this on Windows, or I can also use one of my Linux virtual machines if it's faster.
Use netcat, or nc:
:top
nc -l -p 80 -q 1 < index.html
goto top
It's a simple binary without any installation. It doesn't do CGI or PHP or anything, but it can sure dish up 5 lines of HTML.
Actually, if you use the "k" (keep-alive) option you can remove the loop, and make it simpler:
nc -kl 80 < index.html
Since you need a web server for testing and no heavy concurrent use is expected, I'll just keep it simple.
Please note that both solutions are very simple but not very secure, use them for development purposes but don't rely on neither of them for anything barely similar to a stable (people would say "production") server.
Navigate to the directory where your HTML file is located using cmd.exe, then issue:
Using Python
python -m SimpleHTTPServer
A HTTP server will be started on port 8000. Should you need a different port, just specify it:
python -m SimpleHTTPServer 8080
SimpleHTTPServer is part of the "batteries included": you will not need to install any extra package, apart from the Python interpreter, of course.
Python comes already installed on most Linux distributions, so switching to Linux might be simpler than install Python on Windows, although that boils down to downloading and running an installer.
Using PHP 5.4 or above
php -S 0.0.0.0:8080
This will also process PHP scripts, but HTML resources will be served fine.
http://www.lighttpd.net/ is pretty light weight and easy to get running.
I recently used mongoose for a similar purpose. It supports Windows. From the homepage:
Mongoose executable does not depend on any external library or
configuration. If it is copied to any directory and executed, it
starts to serve that directory on port 8080. If some additional config
is required - for example, different listening port or IP-based access
control, then a mongoose.conf file with respective options (see
example) can be created in the same directory where executable lives.
This makes Mongoose perfect for all sorts of demos, quick tests, file
sharing, and Web programming.
Download the windows exe (no need to install) from here , save it on the folder where your html file is and execute it. Check the image below to know how to start the server:
After selecting Start Browser on Port 8080 your browser will open automatically displaying the contents of the folder.

making an XML dump of a MediaWiki using dumpBackup.php

Using the MediaWiki maintenance script called dumpBackup.php I want to create an XML dump of my MediaWiki.
To do this you have to login to the server using an SSH client, I'm using Putty (Windows), but I also tried it on OSX using Terminal.
According to the MediaWiki Manual for dumpBackup.php this is done using these commands:
cd w/maintenance
php dumpBackup.php --full >d:\backup.xml
Since I am using GoDaddy hosting the last line is a bit different for me. The reason is that SSH for GoDaddy by default still uses php4 (unlike the HTTP server). For this reason my command is (assuming you are also in the maintenance folder):
usr/local/php5/bin/php dumpBackup --full >d:\backup.xml
The however, all this does for me is print everything on the screen and no file is created. Does anybody know why this is and how to make sure the file is created.
You left out the > from the original example:
php dumpBackup.php --full >d:\backup\dump.xml
The > tells the shell to redirect the output of the script to the file d:\backup\dump.xml instead of the screen.
By the way, d:\backup\dump.xml is a Windows file name. Since your server seems to be using a Unixish OS (probably Linux), you probably don't want to use that filename. However, if you don't mind having the file created in your current directory, just plain dump.xml will work fine on both Windows and *nix.
You could also try e.g. ~/dump.xml or $HOME/dump.xml (both of which create the file in your home directory) or $TMP/dump.xml (which creates it in the directory designed for temporary files, usually /tmp.) This could be useful if you don't have enough space available in the directory you installed MediaWiki in.
To see how much space you do have, try the commands df -h (which shows the amount of actual free space) and quota -vs (which shows how much of that space you're allowed to use, if that has been limited). For more help with these commands, try man df and/or man quota.

How to use GVIM to edit a remote file?

I use GVIM on Ubuntu 9.10. I'm looking for the right way to configure GVIM to be able to edit remote files (HTML, PHP, CSS) by for exemple ftp.
When i use :e scp://username#remotehost/./path/to/file i get: error detected while processing BufEnter Auto commands for "*":E472: Command failed.
When i open a file on remote via Dolphin or Nautilus, i cannot use other files with NERDTree.
Finally when i edit on remote a file via Dolphin the rights are changing to access interdit.
So how to use GVIM to edit remote files like on my localhost?
I've found running the filesystem over ssh (by means of sshfs) a better option than having the editor handle that stuff or running the editor itself over an ssh tunnel.
So you need to
apt-get install sshfs
and then
sshfs remoteuser#remotehost:/remote/path /local/mountpoint
And that will let you edit your remote files as if they were on your local file system.
To make it even smoother you can add a line to /etc/fstab
sshfs#remoteusername#remotehost:/remote/path /local/mountpoint fuse user,noauto
For some reason I find that I have to use fusermount -u /local/mountpoint rather then just umount /local/mountpoint when experimenting with this. Maybe that's just my distro.
Recently I've also noted that the mounting user must be in the fuse group. So:
sudo addgroup <username> fuse
An other popular option of course, would be to run vim (rather then gvim) inside a GNU Screen session on one machine and connect to that session via ssh from wherever you happen to be. Code along all day at work and in the evening you ssh into your office computer, reattach to your gnu screen session and pick up exactly where you left off. I used find the richer color palette to be the only thing I really missed from gvim when using vim, but that can actually be fixed thanks to a fork of urxvt that will let you customize the entire 256 position color palette, not just the 16 first positions of the palette that most terminal emulators will let you customize.
There is one way and that is using the remote host's copy, using SSH to forward the X11 client to you, like so:
user#local:~/$ ssh -X user#host
...
user#host:~/$ gvim file
The latter command should open gvim on your desktop. Of course, this relies on the remote host having X11 / gnome / gvim installed in the first place, which might not be the solution you're looking for / an option in your case.
Note: X11 forwarding can be a security risk.
In order for netrw to work seamlessly, I believe you need to not be in compatibility mode.
Try
:set nocompatible
then
:edit scp://host/path/to/file
Try this
:e scp://username#remotehost//path/to/file
Note that the use of // is intentional after remotehost it gives the absolute path of your file
:)
http://www.celsius1414.com/2009/08/19/how-to-edit-remote-files-with-local-vim/
The vim tips wiki has an article on this, Editing remote files via scp in vim.
EDIT: Key authentication is not necessary for opening files over ssh. Vim will prompt for password.
It would be useful to note if netrw.vim was loaded by vim when it started.
:echo exists("g:loaded_netrwPlugin")
For opening files over ssh, you need your local machine's public key in the server's authorized keys. Following help section in vim documentation explains it pretty well.
:help netrw-ssh-hack
Quick way to export public key would be by using ssh-copy-id (if available).
ssh-copy-id user#host
And have a look at netrw documentation for network file editing over other protocols.
:help netrw
HTH.
According to the docs BufEnter is processed after the file has been read and the buffer created, so my guess is that netrw successfully read the file but you have a plugin that assumes the file is on the local filesystem and is trying to access it, e.g. to run ctags.
Try disabling all your plugin scripts except the default Vim ones, and then editing the file.
Also, try editing a directory to see if netrw can read that - you need to put the / on the end so that netrw knows it is a dir.
About your command, :e scp://username#remotehost/./path/to/file : note that with netrw, scp is taken relative to your home directory on that remote host. To avoid home-relative pathing, drop that "."; ie. :e scp://username#remotehost//path/to/file .
to accomplish this on windows download/install the Dokan library and Dokan SSHFS, which are the first and last links on this page.
I didn't think you were going to be able to directly edit a remote file using GVIM running locally. However, as others have pointed out, this is defintiely possible. This looks very interesting; I will check this out. I will leave the rest of my post up here, in case it is useful to anyone else, as an alternative method. This method will work even if you don't have SSH access to the file (ie, you only have FTP, or S3, or whatever).
You may get that effect, though, by tying GVIM into a graphical file transfer application. For example, on OS X, I use CyberDuck to transfer files (FTP, SFTP, etc). Then, I have it configured to use GVIM as my editor, so I can just double-click on a file in the remote listing, and CyberDuck will download a copy of that remote file, and open it in GVIM. When I save it in GVIM, CyberDuck uploads the file back to the remote host.
I'm sure that this functionality is not unique to CyberDuck, and is probably present in most nicer file transfer utilities.

Why doesn't Inno Setup compiler set the version info correctly from hudson?

If I run Inno Setup compiler from a command line/batch file it creates an exe with the version information in the file name.
However, when I run from hudson (same command line) I don't get the version information.
Perhaps I am missing something.
Is this a known issue?
This is the way I am doing it in the iss script file.
#define FileVerStr GetFileVersion(SrcApp)
EDIT:
The env vars are all set for all users - not just my login - so the service has access to everything that the command line build does.
EDIT: See my answer for a resolution of this.
Like "tim" has said, then relative paths doesn't work as expected for defines.
#define MyAppVer GetFileVersion(SourcePath + "\..\Build\Release\MyExeName.exe")
#if MyAppVer == ""
#error MyAppVer - Version information not found!
#endif
By prefixing with SourcePath then the relative path will start from the path where the InnoSetup-script is located.
You are likely running Hudson on Windows given the technology mentioned.
When there is a discrepancy between what happens on the command line and what Hudson does, it is often because Hudson is running as a service on Windows. This means it is running as the service user, which is distinct from your login account.
I would look for an environment variable that you have defined in your user profile that may enable this behavior, that is not being set for the service user.
I am not exactly sure how to describe how I "fixed" this/worked around it.
It seems the GetFileVersion() method does not use the same base path as the other part of the Inno functionality that determines where the source files/installable files are.
The SAME relative paths used for:
// this is for determining what files get put into the install image
[Files]
Source: ..\Build\ForRelease\MyExeName.exe; DestDir: {app}
and
#define SrcApp "..\Build\ForRelease\MyExename.exe"
#define FileVerStr GetFileVersion(SrcApp)
apparently do not use the same mechanism to resolve the file name/path. So what i did to work around this was to copy the exe file that contains the version info to two additional different locations (aside from ..\Build\ForRelease) - one where hudson starts the processes and also to the path where the inoo script is. (I am too lazy to figure out which one is the one that makes it all work.
Again, this works fine from my batch file but not from hudson. It is essentially a strange interaction with how Inno works I guess.