Search Results

Search found 983 results on 40 pages for 'manifest'.

Page 5/40 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Creating an SMF service for mercurial web server

    - by Chris W Beal
    I'm working on a project at the moment, which has a number of contributers. We're managing the project gate (which is stand alone) with mercurial. We want to have an easy way of seeing the changelog, so we can show management what is going on.  Luckily mercurial provides a basic web server which allows you to see the changes, and drill in to change sets. This can be run as a daemon, but as it was running on our build server, every time it was rebooted, someone needed to remember to start the process again. This is of course a classic usage of SMF. Now I'm not an experienced person at writing SMF services, so it took me 1/2 an hour or so to figure it out the first time. But going forward I should know what I'm doing a bit better. I did reference this doc extensively. Taking a step back, the command to start the mercurial web server is $ hg serve -p <port number> -d So we somehow need to get SMF to run that command for us. In the simplest form, SMF services are really made up of two components. The manifest Usually lives in /var/svc/manifest somewhere Can be imported from any location The method Usually live in /lib/svc/method I simply put the script straight in that directory. Not very repeatable, but it worked Can take an argument of start, stop, or refresh Lets start with the manifest. This looks pretty complex, but all it's doing is describing the service name, the dependencies, the start and stop methods, and some properties. The properties can be by instance, that is to say I could have multiple hg serve processes handling different mercurial projects, on different ports simultaneously Here is the manifest I wrote. I stole extensively from the examples in the Documentation. So my manifest looks like this $ cat hg-serve.xml <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <service_bundle type='manifest' name='hg-serve'> <service name='application/network/hg-serve' type='service' version='1'> <dependency name='network' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/milestone/network:default' /> </dependency> <exec_method type='method' name='start' exec='/lib/svc/method/hg-serve %m' timeout_seconds='2' /> <exec_method type='method' name='stop' exec=':kill' timeout_seconds='2'> </exec_method> <instance name='project-gate' enabled='true'> <method_context> <method_credential user='root' group='root' /> </method_context> <property_group name='hg-serve' type='application'> <propval name='path' type='astring' value='/src/project-gate'/> <propval name='port' type='astring' value='9998' /> </property_group> </instance> <stability value='Evolving' /> <template> <common_name> <loctext xml:lang='C'>hg-serve</loctext> </common_name> <documentation> <manpage title='hg' section='1' /> </documentation> </template> </service> </service_bundle> So the only things I had to decide on in this are the service name "application/network/hg-serve" the start and stop methods (more of which later) and the properties. This is the information I need to pass to the start method script. In my case the port I want to start the web server on "9998", and the path to the source gate "/src/project-gate". These can be read in to the start method. So now lets look at the method scripts $ cat /lib/svc/method/hg-serve #!/sbin/sh # # # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # # Standard prolog # . /lib/svc/share/smf_include.sh if [ -z $SMF_FMRI ]; then echo "SMF framework variables are not initialized." exit $SMF_EXIT_ERR fi # # Build the command line flags # # Get the port and directory from the SMF properties port=`svcprop -c -p hg-serve/port $SMF_FMRI` dir=`svcprop -c -p hg-serve/path $SMF_FMRI` echo "$1" case "$1" in 'start') cd $dir /usr/bin/hg serve -d -p $port ;; *) echo "Usage: $0 {start|refresh|stop}" exit 1 ;; esac exit $SMF_EXIT_OK This is all pretty self explanatory, we read the port and directory using svcprop, and use those simply to run a command in the start case. We don't need to implement a stop case, as the manifest says to use "exec=':kill'for the stop method. Now all we need to do is import the manifest and start the service, but first verify the manifest # svccfg verify /path/to/hg-serve.xml If that doesn't give an error try importing it # svccfg import /path/to/hg-serve.xml If like me you originally put the hg-serve.xml file in /var/svc/manifest somewhere you'll get an error and told to restart the import service svccfg: Restarting svc:/system/manifest-import The manifest being imported is from a standard location and should be imported with the command : svcadm restart svc:/system/manifest-import # svcadm restart svc:/system/manifest-import and you're nearly done. You can look at the service using svcs -l # svcs -l hg-serve fmri svc:/application/network/hg-serve:project-gate name hg-serve enabled false state disabled next_state none state_time Thu May 31 16:11:47 2012 logfile /var/svc/log/application-network-hg-serve:project-gate.log restarter svc:/system/svc/restarter:default contract_id 15749 manifest /var/svc/manifest/network/hg/hg-serve.xml dependency require_all/none svc:/milestone/network:default (online) And look at the interesting properties # svcprop hg-serve hg-serve/path astring /src/project-gate hg-serve/port astring 9998 ...stuff deleted.... Then simply enable the service and if every things gone right, you can point your browser at http://server:9998 and get a nice graphical log of project activity. # svcadm enable hg-serve # svcs -l hg-serve fmri svc:/application/network/hg-serve:project-gate name hg-serve enabled true state online next_state none state_time Thu May 31 16:18:11 2012 logfile /var/svc/log/application-network-hg-serve:project-gate.log restarter svc:/system/svc/restarter:default contract_id 15858 manifest /var/svc/manifest/network/hg/hg-serve.xml dependency require_all/none svc:/milestone/network:default (online) None of this is rocket science, but a bit fiddly. Hence I thought I'd blog it. It might just be you see this in google and it clicks with you more than one of the many other blogs or how tos about it. Plus I can always refer back to it myself in 3 weeks, when I want to add another project to the server, and I've forgotten how to do it.

    Read the article

  • Ruby On Rails with HTML5 offline apps - Firefox does not cache the application.manifest but Safari does

    - by hoitomt
    I'm working off of this Railscast tutorial: episode 247 I’m up to this point in the tutorial: added the rack-offline gem, added the application.manifest route, and added a reference to the manifest in the html tag. Right before it starts talking about problems with caching. Safari works as intended – When the server is running the page is served. From the server logs I can see that Safari is making a single request to the server every time for the items page. When I turn off the server the page displays as well, even after shutting down the browser and restarting. It appears to be pulling from the application.manifest (cache manifest). Firefox does not work as intended – When accessing the page for the first time, Firefox lets me know that the web page wants to store something locally, I allow. After clicking on allow, Firefox makes 5 requests to the server for the page (from the server log). The hash is different in every request. Is it is possible that the changing hash is triggering Firefox to keep trying to get the new manifest until it reaches some maximum (5 attempts)? Then, after the server is stopped, Firefox will not show the page at all. It looks like it isn’t caching the application.manifest. Firefox also gives you a way to see what sites are storing stuff locally by going to Tools/Options/Advanced/Network (Firefox/Preferences/Advanced/Network on Apple). I see localhost there but the size is 0 bytes. So for some reason, Firefox is not downloading my application.manifest along with the files

    Read the article

  • How to force visual styles when using .NET forms Interop from VB6

    - by Matt
    I have created a VB.NET Class Library that exposes some COM Interop sub routines. These in turn show various forms that are contained within the Class Library. When the forms are shown from VB6 they do not inherit the visual styles of the operating system and act like VB6 controls. I gather that this probably by design but is there some way to force/control visual styles manually in the .NET assembly? I would imagine that if I use a manifest in my VB6 app then everything will use the correct style but I would like to be able to control this myself if possible because we are using 3rd party controls in VB6 that do not require a manifest.

    Read the article

  • include external jar when running java -jar

    - by prmatta
    From my readings, when you execute a command as follows: java -jar foo.jar Then the main classpath is ignored and the classpath is taken from the manifest file. Further, the classpath declared on the command line is also ignored. So in: java -classpath /usr/local/jar/foobar.jar -jar foo.jar /usr/local/jar/foobar.jar is ignored. Lastly, I have read that the manifest file can only only contain relative paths, within the jar file. So, how do you include absolute paths to external jars, that are present on the system, but not in the jar file being executed?

    Read the article

  • Android Market Publishing Issues

    - by Steve
    I have an app which I have just updated to froyo to take advantage of the move to SD card feature. I am now trying to upload the update to the market but I keep getting the following error: "The file is invalid: W/ResourceType( 7193): Bad string block: last string is not 0- terminated ERROR getting 'android:label' attribute: attribute is not a string value". I changed the value in the manifest from "android:label="@string/app_name" " to "android:label="test" " and uploaded it, then it started complaining about the icon, saying that it wasn't a string. Anyone have any ideas? The application part of my manifest is shown below and I'm properly confused. The app compiles into an APK, it even installs and runs fine on my N1 (installing from SD card) it just won't upload to the market. Any help would be greatly appreciated, I have absolutely no idea what's wrong, seems like I've tried everything I can think of including re-installing eclipse. Cheers Steve

    Read the article

  • My android app crash before load main.xml

    - by Saverio Puccia
    my android app crash before load main.xml. This is the exception thrown java.lang.RuntimeException: Unable to resume activity...: java.lang.NullPointerException What happens? For completeness I enclose my manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="saverio.puccia.nfcauth" android:versionCode="1" android:versionName="1.0" > //permission <uses-sdk android:minSdkVersion="10" /> <uses-permission android:name="android.permission.NFC"></uses-permission> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> //main declaration <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".NFCAuthActivity" android:label="@string/app_name" > //intent filter declaration <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.NDEF_DISCOVER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> LOGCAT 06-25 11:03:23.670: E/AndroidRuntime(4323): FATAL EXCEPTION: main 06-25 11:03:23.670: E/AndroidRuntime(4323): java.lang.RuntimeException: Unable to resume activity {saverio.puccia.nfcauth/saverio.puccia.nfcauth.NFCAuthActivity}: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2456) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2484) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1998) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.access$600(ActivityThread.java:127) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Handler.dispatchMessage(Handler.java:99) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Looper.loop(Looper.java:137) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.main(ActivityThread.java:4507) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invokeNative(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invoke(Method.java:511) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 06-25 11:03:23.670: E/AndroidRuntime(4323): at dalvik.system.NativeStart.main(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): Caused by: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at saverio.puccia.nfcauth.NFCAuthActivity.onResume(NFCAuthActivity.java:103) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1157) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Activity.performResume(Activity.java:4539) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2446) 06-25 11:03:23.670: E/AndroidRuntime(4323): ... 12 more 06-25 11:03:23.670: W/ActivityManager(1998): Force finishing activity r.intent.getComponent().flattenToShortString()

    Read the article

  • Android: HTTPClient

    - by primal
    Hi, I was trying http-cleint tutorials from svn.apache.org. While running the application I am getting the following error in console. [2010-04-30 09:26:36 - HalloAndroid] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.org.example/.HalloAndroid } from null (pid=-1, uid=-1) requires android.permission.INTERNET I have added android.permission.INTERNET in AndroidManifest.xml. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.org.example" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HalloAndroid" android:label="@string/app_name" android:permission="android.permission.INTERNET"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"></uses-permission> </manifest> The java code in HalloAndroid.java is as follows HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget2 = new HttpGet("http://google.com/"); HttpResponse response2 = null; try { response2 = httpclient.execute(httpget2); } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } HttpEntity entity = response2.getEntity(); if (entity != null) { long len = entity.getContentLength(); if (len != -1 && len < 2048) { try { Log.d(TAG, EntityUtils.toString(entity)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { // Stream content out } Any help is much appreciated.

    Read the article

  • Why doesn't my android application show up in the launcher?

    - by rushinge
    I'm developing an application for the Android platform targeted for api level 4 (Android 1.6) but I can't get it to show up on my phone and I can't figure out why. Here's my AndroidManifest.xml is there a problem in here? Or is there something else I should be looking at? <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sbe.app.hellocogen" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".activity.ListPlants" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".activity.AddPlant" android:label="Add Plant"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <activity android:name=".activity.UnitActivity" android:label="IP HERE, PLANT NAME"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4"/> </manifest> When I started this application it didn't show up but I fixed it by setting the minimum api level to 4 instead of 7 then it started showing up but now it stopped showing up again and I don't know why.

    Read the article

  • Updating a Safari Extension?

    - by Ricky Romero
    Hi there, I'm writing a simple Safari Extension, and I'm trying to figure out how to get the update mechanism working. Apple's documentation here is delightfully vague: http://developer.apple.com/safari/library/documentation/Tools/Conceptual/SafariExtensionGuide/UpdatingExtensions/UpdatingExtensions.html And here's my manifest, based on that documentation: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Extension Updates</key> <array> <dict> <key>CFBundleIdentifier</key> <string>net.rickyromero.safari.shutup</string> <key>Team Identifier</key> <string>TMM5P68287</string> <key>CFBundleVersion</key> <string>1</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>URL</key> <string>http://rickyromero.net/misc/SafariExtensions/ShutUp.safariextz</string> </dict> </array> </dict> </plist> I don't know where to get "YourCertifcateID," for example. And when I increment the values for CFBundleVersion and CFBundleShortVersionString, it doesn't trigger an update. I know Safari is hitting my manifest though, because I'm watching HTTP traffic. Thoroughly stumped. Any ideas, guys?

    Read the article

  • UAC need for console application

    - by Daok
    I have a console application that require to use some code that need administrator level. I have read that I need to add a Manifest file myprogram.exe.manifest that look like that : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator"> </requestedPrivileges> </security> </trustInfo> </assembly> But it still doesn't raise the UAC (in the console or in debugging in VS). How can I solve this issue? Update I am able to make it work if I run the solution in Administrator or when I run the /bin/*.exe in Administrator. I am still wondering if it's possible to have something that will pop when the application start instead of explicitly right clickRun as Administrator?

    Read the article

  • What do I need to do to make sure my app launches as Admin?

    - by John Gietzen
    I'm writing an app that allows you to script the buttons from a wiimote into actions on your PC. It currently supports all of the features of the main remote control, except for the speaker. Now, I'm running in to trouble when I run it on Vista with UAC turned on. Any time a UAC'd window has focus, my app fails to move the mouse successfully. For instance, when an installer is run, I have to navigate it with the keyboard. Will running the app as administrator solve my problem? (At one point in time, I was able to successfully move the mouse over a UAC-password-entry box) How do I build a manifest that will tell windows to "run as administrator"? How do I embed this manifest into my app, if I'm strongly naming my assembly? How do I sign my application with an Authenticode cert? EDIT: Ok, so after some more extensive research, I have found: http://msdn.microsoft.com/en-us/library/bb756929.aspx <requestedExecutionLevel level="asInvoker|highestAvailable|requireAdministrator" uiAccess="true|false"/> However, the article says: Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. \Program Files\ and \windows\system32\ are currently the two allowable protected locations. I have edited the question to reflect the new developments.

    Read the article

  • My Android XML files can't find ActionBarSherlock themes

    - by MalcolmMcC
    I'm trying to develop an app with ActionBarSherlock and everything works except the theming. Specifically, I can import com.actionbarsherlock.app.*, extend SherlockActivity, but I always have this error in my manifest: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.Sherlock'). I know there have been plenty of questions asked about this, but they have not worked for me. I have tried refreshing the workspace cleaning all of my projects putting the line in both the <activity> and the <application> setting my targetSdkVersion and minSdkVersion to various values, in both my manifest and ABS's and I've tried the following variations, and probably others: android:theme="@style/Theme.Sherlock" android:theme="@android:style/Theme.Sherlock" theme="@style/Theme.Sherlock" theme="@android:style/Theme.Sherlock" theme="@theme/Theme.Sherlock" theme="@android:theme/Theme.Sherlock" It's worth noting that the autocomplete after I typed "@style/" was showing nothing, so I tried making my own style in styles.xml and then that showed up but still nothing from ActionBarSherlock. Also, in styles.xml, I tried to make my own theme to extend Theme.Sherlock, and @style/Theme.Sherlock was not found there either when I tried to add it as a parent. I tried loading the samples but got a JAR Mismatch. My conclusion is that somehow my xml files are unable to access the ABS library, but I'm at a loss as to how to fix it. Any help hugely appreciated.

    Read the article

  • How to include different resolution icons with Android App?

    - by Gerry
    The Android docs indicate that I should ship with different icons for different resolution phone screens. http://developer.android.com/guide/practices/screens_support.html#qualifiers res/drawable-ldpi/my_icon.png // icon image for low density res/drawable-mdpi/dpi/my_icon.png // icon for medium density res/drawable-hdpi/my_icon.png // icon image for high density This does not work when compiling with Eclipse for the Android. Does anyone has an example of a manifest file that works for multiple resolution icons? Thanks, Gerry

    Read the article

  • How can I check for GPS support in-App to add a feature for those with Location services enabled?

    - by Brian Lacy
    How can I check for GPS support in-App to add a feature for those with Location services enabled? My concern is, I know I'd have to specify the tag in the manifest to declare that the app uses location services, but I still want the app to function for those without. I just want to check and, if the service is available, use it; otherwise just ignore that one feature. Thanks.

    Read the article

  • HTML5 Offline Storage on iPad and iPhone BUG

    - by scaraveos
    Hello everyone, I created a manifest file with 1000 items. Safari, Mozilla browsers are saving the files offline successfully and even Android saves the files correctly offline. On iPad and iPhone when I am trying to save more than 300 items in some point the applicationCache returns "error". When I am trying to save less (e.x.: 200) it saves the files correctly and the applicationCache returns "cached". Any ideas? Thank you.

    Read the article

  • Listing an application's activity and intent-filters?

    - by MBonig
    I am interested in activating another application's activity. I know from reading the Android SDK that it's probably better to do this with an implicit intent. However, this activity doesn't reside in an application I own, so I don't know the action and category and data flags on the intent-filter. How can I examine an Android applications metadata like the activity classes and the intent-filters for those activities (if declared in the manifest)? Thanks!

    Read the article

  • How to safely reboot via First Boot script

    - by unixman
    With the cost and performance benefits of the SPARC T4 and SPARC T5 systems undeniably validated, the banking sector is actively moving to Solaris 11.  I was recently asked to help a banking customer of ours look at migrating some of their Solaris 10 logic over to Solaris 11.  While we've introduced a number of holistic improvements in Solaris 11, in terms of how we ease long-term software lifecycle management, it is important to appreciate that customers may not be able to move all of their Solaris 10 scripts and procedures at once; there are years of scripts that reflect fine-tuned requirements of proprietary banking software that gets layered on top of the operating system. One of these requirements is to go through a cycle of reboots, after the system is installed, in order to ensure appropriate software dependencies and various configuration files are in-place. While Solaris 10 introduced a facility that aids here, namely SMF, many of our customers simply haven't yet taken the time to take advantage of this - proceeding with logic that, while functional, without further analysis has an appearance of not being optimal in terms of taking advantage of all the niceties bundled in Solaris 11 at no extra cost. When looking at Solaris 11, we recognize that one of the vehicles that bridges the gap between getting the operating system image payload delivered, and the customized banking software installed, is a notion of a First Boot script.  I had a working example of this at one of the Oracle OpenWorld sessions a few years ago - we've since improved our documentation and have introduced sections where this is described in better detail.   If you're looking at this for the first time and you've not worked with IPS and SMF previously, you might get the sense that the tasks are daunting.   There is a set of technologies involved that are jointly engineered in order to make the process reliable, predictable and extensible. As you go down the path of writing your first boot script, you'll be faced with a need to wrap it into a SMF service and then packaged into a IPS package. The IPS package would then need to be placed onto your IPS repository, in order to subsequently be made available to all of your AI (Automated Install) clients (i.e. the systems that you're installing Solaris and your software onto).     With this blog post, I wanted to create a single place that outlines the entire process (simplistically), and provide a hint of how a good old "at" command may make the requirement of forcing an initial reboot handy. The syntax and references to commands here is based on running this on a version of Solaris 11 that has been updated since its initial release in 2011 (i.e. I am writing this on Solaris 11.1) Assuming you've built an AI server (see this How To article for an example), you might be asking yourself: "Ok, I've got some logic that I need executed AFTER Solaris is deployed and I need my own little script that would make that happen. How do I go about hooking that script into the Solaris 11 AI framework?"  You might start here, in Chapter 13 of the "Installing Oracle Solaris 11.1 Systems" guide, which talks about "Running a Custom Script During First Boot".  And as you do, you'll be confronted with command that might be unfamiliar to you if you're new to Solaris 11, like our dear new friend: svcbundle svcbundle is an aide to creating manifests and profiles.  It is awesome, but don't let its awesomeness overwhelm you. (See this How To article by my colleague Glynn Foster for a nice working example).  In order to get your script's logic integrated into the Solaris 11 deployment process, you need to wrap your (shell) script into 2 manifests -  a SMF service manifest and a IPS package manifest.  ....and if you're new to XML, well then -- buckle up We have some examples of small first boot scripts shown here, as templates to build upon. Necessary structure of the script, particularly in leveraging SMF interfaces, is key. I won't go into that here as that is covered nicely in the doc link above.    Let's say your script ends up looking like this (btw: if things appear to be cut-off in your browser, just select them, copy and paste into your editor and it'll be grabbed - the source gets captured eventhough the browser may not render it "correctly" - ah, computers). #!/bin/sh # Load SMF shell support definitions . /lib/svc/share/smf_include.sh # If nothing to do, exit with temporary disable completed=`svcprop -p config/completed site/first-boot-script-svc:default` [ "${completed}" = "true" ] && \ smf_method_exit $SMF_EXIT_TEMP_DISABLE completed "Configuration completed" # Obtain the active BE name from beadm: The active BE on reboot has an R in # the third column of 'beadm list' output. Its name is in column one. bename=`beadm list -Hd|nawk -F ';' '$3 ~ /R/ {print $1}'` beadm create ${bename}.orig echo "Original boot environment saved as ${bename}.orig" # ---- Place your one-time configuration tasks here ---- # For example, if you have to pull some files from your own pre-existing system: /usr/bin/wget -P /var/tmp/ $PULL_DOWN_ADDITIONAL_SCRIPTS_FROM_A_CORPORATE_SYSTEM /usr/bin/chmod 755 /var/tmp/$SCRIPTS_THAT_GOT_PULLED_DOWN_IN_STEP_ABOVE # Clearly the above 2 lines represent some logic that you'd have to customize to fit your needs. # # Perhaps additional things you may want to do here might be of use, like # (gasp!) configuring ssh server for root login and X11 forwarding (for testing), and the like... # # Oh and by the way, after we're done executing all of our proprietary scripts we need to reboot # the system in accordance with our operational software requirements to ensure all layered bits # get initialized properly and pull-in their own modules and components in the right sequence, # subsequently. # We need to set a "time bomb" reboot, that would take place upon completion of this script. # We already know that *this* script depends on multi-user-server SMF milestone, so it should be # safe for us to schedule a reboot for 5 minutes from now. The "at" job get scheduled in the queue # while our little script continues thru the rest of the logic. /usr/bin/at now + 5 minutes <<REBOOT /usr/bin/sync /usr/sbin/reboot REBOOT # ---- End of your customizations ---- # Record that this script's work is done svccfg -s site/first-boot-script-svc:default setprop config/completed = true svcadm refresh site/first-boot-script-svc:default smf_method_exit $SMF_EXIT_TEMP_DISABLE method_completed "Configuration completed"  ...and you're happy with it and are ready to move on. Where do you go and what do you do? The next step is creating the IPS package for your script. Since running the logic of your script constitutes a service, you need to create a service manifest. This is described here, in the middle of Chapter 13 of "Creating an IPS package for the script and service".  Assuming the name of your shell script is first-boot-script.sh, you could end up doing the following: $ cd some_working_directory_for_this_project$ mkdir -p proto/lib/svc/manifest/site$ mkdir -p proto/opt/site $ cp first-boot-script.sh proto/opt/site  Then you would create the service manifest  file like so: $ svcbundle -s service-name=site/first-boot-script-svc \ -s start-method=/opt/site/first-boot-script.sh \ -s instance-property=config:completed:boolean:false -o \ first-boot-script-svc-manifest.xml   ...as described here, and place it into the directory hierarchy above. But before you place it into the directory, make sure to inspect the manifest and adjust the appropriate service dependencies.  That is to say, you want to properly specify what milestone should be reached before your service runs.  There's a <dependency> section that looks like this, before you modify it: <dependency restart_on="none" type="service" name="multi_user_dependency" grouping="require_all"> <service_fmri value="svc:/milestone/multi-user"/>  </dependency>  So if you'd like to have your service run AFTER the multi-user-server milestone has been reached (i.e. later, as multi-user-server has more dependencies then multi-user and our intent to reboot the system may have significant ramifications if done prematurely), you would modify that section to read:  <dependency restart_on="none" type="service" name="multi_user_server_dependency" grouping="require_all"> <service_fmri value="svc:/milestone/multi-user-server"/>  </dependency> Save the file and validate it: $ svccfg validate first-boot-script-svc-manifest.xml Assuming there are no errors returned, copy the file over into the directory hierarchy: $ cp first-boot-script-svc-manifest.xml proto/lib/svc/manifest/site Now that we've created the service manifest (.xml), create the package manifest (.p5m) file named: first-boot-script.p5m.  Populate it as follows: set name=pkg.fmri value=first-boot-script-AT-1-DOT-0,5.11-0 set name=pkg.summary value="AI first-boot script" set name=pkg.description value="Script that runs at first boot after AI installation" set name=info.classification value=\ "org.opensolaris.category.2008:System/Administration and Configuration" file lib/svc/manifest/site/first-boot-script-svc-manifest.xml \ path=lib/svc/manifest/site/first-boot-script-svc-manifest.xml owner=root \ group=sys mode=0444 dir path=opt/site owner=root group=sys mode=0755 file opt/site/first-boot-script.sh path=opt/site/first-boot-script.sh \ owner=root group=sys mode=0555 Now we are going to publish this package into a IPS repository. If you don't have one yet, don't worry. You have 2 choices: You can either  publish this package into your mirror of the Oracle Solaris IPS repo or create your own customized repo.  The best practice is to create your own customized repo, leaving your mirror of the Oracle Solaris IPS repo untouched.  From this point, you have 2 choices as well - you can either create a repo that will be accessible by your clients via HTTP or via NFS.  Since HTTP is how the default Solaris repo is accessed, we'll go with HTTP for your own IPS repo.   This nice and comprehensive How To by Albert White describes how to create multiple internal IPS repos for Solaris 11. We'll zero in on the basic elements for our needs here: We'll create the IPS repo directory structure hanging off a separate ZFS file system, and we'll tie it into an instance of pkg.depotd. We do this because we want our IPS repo to be accessible to our AI clients through HTTP, and the pkg.depotd SMF service bundled in Solaris 11 can help us do this. We proceed as follows: # zfs create rpool/export/MyIPSrepo # pkgrepo create /export/MyIPSrepo # svccfg -s pkg/server add MyIPSrepo # svccfg -s pkg/server:MyIPSrepo addpg pkg application # svccfg -s pkg/server:MyIPSrepo setprop pkg/port=10081 # svccfg -s pkg/server:MyIPSrepo setprop pkg/inst_root=/export/MyIPSrepo # svccfg -s pkg/server:MyIPSrepo addpg general framework # svccfg -s pkg/server:MyIPSrepo addpropvalue general/complete astring: MyIPSrepo # svccfg -s pkg/server:MyIPSrepo addpropvalue general/enabled boolean: true # svccfg -s pkg/server:MyIPSrepo setprop pkg/readonly=true # svccfg -s pkg/server:MyIPSrepo setprop pkg/proxy_base = astring: http://your_internal_websrvr/MyIPSrepo # svccfg -s pkg/server:MyIPSrepo setprop pkg/threads = 200 # svcadm refresh application/pkg/server:MyIPSrepo # svcadm enable application/pkg/server:MyIPSrepo Now that the IPS repo is created, we need to publish our package into it: # pkgsend publish -d ./proto -s /export/MyIPSrepo first-boot-script.p5m If you find yourself making changes to your script, remember to up-rev the version in the .p5m file (which is your IPS package manifest), and re-publish the IPS package. Next, you need to go to your AI install server (which might be the same machine) and modify the AI manifest to include a reference to your newly created package.  We do that by listing an additional publisher, which would look like this (replacing the IP address and port with your own, from the "svccfg" commands up above): <publisher name="firstboot"> <origin name="http://192.168.1.222:10081"/> </publisher>  Further down, in the  <software_data action="install">  section add: <name>pkg:/first-boot-script</name> Make sure to update your Automated Install service with the new AI manifest via installadm update-manifest command.  Don't forget to boot your client from the network to watch the entire process unfold and your script get tested.  Once the system makes the initial reboot, the first boot script will be executed and whatever logic you've specified in it should be executed, too, followed by a nice reboot. When the system comes up, your service should stay in a disabled state, as specified by the tailing lines of your SMF script - this is normal and should be left as is as it helps provide an auditing trail for you.   Because the reboot is quite a significant action for the system, you may want to add additional logic to the script that actually places and then checks for presence of certain lock files in order to avoid doing a reboot unnecessarily. You may also want to, alternatively, remove the SMF service entirely - if you're unsure of the potential for someone to try and accidentally enable that service -- eventhough its role in life is to only run once upon the system's first boot. That is how I spent a good chunk of my pre-Halloween time this week, hope yours was just as SPARCkly^H^H^H^H fun!    

    Read the article

  • Android: Saving custom button and spinner on orientation change

    - by Jacob Huggart
    Hello All, I am new to Android programming and was handed a fairly large program that is almost complete, but needed support for switching between portrait and landscape view. I added android:configChanges="keyboardHidden|orientation" to the manifest and used onConfigurationChanged to save the view data and that works. However, there is a button that displays the date selected (when pressed a calendar to select the date comes up) and a spinner that displays the current view and is used to select a new view. Those two items are being cleared/reset and do not work at all after the screen flip. I have been attempting to use onSaveInstanceState and onRestoreInstanceState to fix that, but I cannot figure out how to get it to work. Any advice? FYI, This is how my spinner is set up: Spinner s = (Spinner) findViewById(R.id.siteSelector); ArrayAdapter<?> adapter = ArrayAdapter.createFromResource( this, R.array.sites, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s.setAdapter(adapter);

    Read the article

  • Permission denial to read from emailprovider in android

    - by Ambika
    Hello Everyone, I've the problem when I want to read "com.android.email.provider" to get email accounts. Here is my code to retrieve the account : Cursor c = null; Uri CONTENT_URI = Uri.parse("content://com.android.email.provider/account"); String RECORD_ID = "_id"; String[] ID_PROJECTION = new String[] {RECORD_ID }; c = getContentResolver().query(CONTENT_URI,ID_PROJECTION,null, null, null); I get a security exception: java.lang.SecurityException: Permission Denial: reading com.android.email.provider.EmailProvider uri content://com.android.email.provider/account from pid=278, uid=10003 requires com.android.email.permission.ACCESS_PROVIDER I want to know the account is created or not in some other app. Is there any other way to resolve this so that I can read from the provider. I have also tried by adding the permission in manifest: That dint not help. Any solution would be greatly appreciated. Thanks in advance

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >